TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A helpful wrapper for testing network requests using NSURLProtocol.
PTLURLProtocol is designed to be very basic, just a wrapper around boilerplate logic when subclassing NSURLProtocol. If you want something more advanced you should take a look at OHHTTPStubs.
@interface MyCustomURLProtocol : PTLURLProtocol
@end
@implementation MyCustomURLProtocol
+ (BOOL)canInitWithRequest:(NSURLRequest *)request {...}
+ (NSURLResponse *)responseForRequest:(NSURLRequest *)request {...}
+ (NSData *)dataForRequest:(NSURLRequest *)request {...}
@end
[MyCustomURLProtocol registerProtocol];
@mattt for introducing the idea on NSHipster.
Brian Partridge - @brianpartridge on Twitter and App.Net