Nocilla
Nocilla copied to clipboard
Add ability to specify a block to execute for response
Example:
stubRequest(@"GET", @"http://www.example.com/").andDo(^(NSDictionary * __autoreleasing *headers, NSInteger *status, id<LSHTTPBody> __autoreleasing *body) {
*status = 200;
*body = @"Response!";
});
The block passed to andDo will not be executed until the request is made. This is useful for varying the response based on object state that changes by the time the request is made, and assertions can be made inside the block to check the state of the object between the "start loading" and "finish loading" states, e.g. XCTAssertTrue(myObj.isLoading);.
I second this request. It would provide a workaround for issue #4 (expectations).
Great. This is really something that is useful! This also enables that you can check on whether the URL got requested or not.
@calmez I believe I've fixed the Cocoapod issue--try it now.
Any chance we can get this working? I'd really like this feature!