Skip to content

Commit

Permalink
Merge pull request square#9 from square/network-willsend-fix
Browse files Browse the repository at this point in the history
Network Request Fix
  • Loading branch information
wlue committed Aug 31, 2012
2 parents 66dc3e7 + d5d4e6a commit dd3d6eb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ObjC/PonyDebugger/PDNetworkDomainController.m
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,27 @@ - (void)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
{

[self performBlock:^{

// If the request wasn't generated yet, then willSendRequest was not called. Send it under the
// assumption that there was no response redirection.

NSURLRequest *request = [self requestForConnection:connection];
if (!request) {
request = connection.currentRequest;
[self setRequest:request forConnection:connection];

PDNetworkRequest *networkRequest = [PDNetworkRequest networkRequestWithURLRequest:request];
[self.domain requestWillBeSentWithRequestId:[self requestIDForConnection:connection]
frameId:@""
loaderId:@""
documentURL:[request.URL absoluteString]
request:networkRequest
timestamp:[NSDate PD_timestamp]
initiator:nil
redirectResponse:nil];
}

[self setResponse:response forConnection:connection];

NSMutableData *dataAccumulator = nil;
Expand Down

0 comments on commit dd3d6eb

Please sign in to comment.