hypoyao / gyhttpmock Goto Github PK
View Code? Open in Web Editor NEWLibrary for replacing part/all HTTP response based on Nocilla.
License: MIT License
Library for replacing part/all HTTP response based on Nocilla.
License: MIT License
首先引入头文件#import "GYHttpMock.h"
然后我调用 [[GYHttpMock sharedInstance]startMock];
就报找不到头文件了,大神求解答一下
小弟,祈求大神出一个Demo吧,根本不知道怎么集成你这个框架,无比郁闷。。。。。。
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html", nil];
//get请求
// SKIODriver * mockDriver=[[SKIODriver alloc]init];
// [mockDriver testUrl:urlString];
mockRequest(@"GET", @"https://www.baidu.com")
.withBody(@"ceshi")
.andReturn(200).withBody(@"{"key":"value"}");
[manager GET:urlString parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
//数据请求的进度
}
看到您是**人...就用中文了
最近在尝试修改iOS app的发包
需要有以下的功能
接收到packet的response的一部分替换发出packet的sent的一部分
实时修改接收包
在mac上可以使用代理实现
然而在ios上有办法直接实现么(越狱环境)
mockRequest(@"POST", @"(.*?)dealer/login(.*?)".regex).withBody(@"{\"account\" : \"18621033332\"}".regex);
添加body后会crash 求指教
使用cocopods配置之后,如果json文件在主app内,无法找到对应文件。
based on Nocilla 是什么意思? 我看这个库是可以单独直接使用的?
mockRequest(@"GET", @"(.?)google.com(.?)".regex).
withBody(@"{"name":"abc"}".regex);
报错:Property 'regex' not found on object of type 'NSString *'
withBody(@"weread.json"); 也报错
能否提供个示例
服务器返回的这种数据格式,withbody就会报错
(
{
"a":1
}
{
"a":2
}
)
能模拟 Service 端 setCookie 吗?或者以后可能会加上这个功能吗?
方便测试查看请求log
我按照示例:
mockRequest(@"GET", @"(.?)google.com(.?)".regex).
withBody(@"{"name":"abc"}".regex);
一跑起来就crash:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid regex pattern: {"name":"abc"}
Error: Error Domain=NSCocoaErrorDomain Code=2048 "The value “{"name":"abc"}” is invalid." UserInfo={NSInvalidValue={"name":"abc"}}'
能否像其他开源库一样在项目中写一个Example工程方便上手?
比如:http://jsonplaceholder.typicode.com/users GET 请求返回的是一个 Array,
而 GYMockURLProtocol
内部通过 NSURLConnection sendAsynchronousRequest:
请求得到的返回数据是通过 NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:json];
进行解析的,
此时 json
是个 Array,导致了 crash。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.