Added support for connection:didReceiveResponse: to be forwarded from RKResponse through RKRequestDelegate

This commit is contained in:
Sylvain Guillopé
2012-03-27 16:08:59 -04:00
committed by Blake Watters
parent 7235499d15
commit 46f668d7e9
4 changed files with 28 additions and 0 deletions

View File

@@ -802,6 +802,14 @@ typedef void(^RKRequestDidFailLoadWithErrorBlock)(NSError *error);
*/
- (void)requestWillPrepareForSend:(RKRequest *)request;
/**
Sent when a request has received a response from the remote host.
@param request The RKRequest object that received a response.
@param response The RKResponse object for the HTTP response that was received.
*/
- (void)request:(RKRequest *)request didReceiveResponse:(RKResponse *)response;
/**
Sent when a request has started loading

View File

@@ -196,6 +196,9 @@ return __VA_ARGS__;
RKLogDebug(@"Headers: %@", [response allHeaderFields]);
_httpURLResponse = [response retain];
[_request invalidateTimeoutTimer];
if ([[_request delegate] respondsToSelector:@selector(request:didReceiveResponse:)]) {
[[_request delegate] request:_request didReceiveResponse:self];
}
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {