Skip to content

Commit

Permalink
NR-359272: fix NRMAURLSessionTaskOverride to not check responseCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdillard-NewRelic committed Jan 16, 2025
1 parent 0b1a8a4 commit 1efe786
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Agent/Instrumentation/NSURLSession/NRMAURLSessionTaskOverride.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ + (void) deinstrument
}
}

+ (NSInteger) statusCode:(NSURLResponse*)response {
return [response isKindOfClass:[NSHTTPURLResponse class]] ? [((NSHTTPURLResponse*)response) statusCode] : -1;
}

// Currently we support NSURLSessionDataTask, NSURLSessionDownloadTask, and NSURLSessionUploadTask.
+ (bool) isSupportedTaskType:(NSURLSessionTask*) task {
return [task isKindOfClass:[NSURLSessionDataTask class]] || [task isKindOfClass:[NSURLSessionDownloadTask class]] || [task isKindOfClass:[NSURLSessionUploadTask class]];
Expand Down Expand Up @@ -137,12 +133,8 @@ void NRMAOverride__urlSessionTask_SetState(NSURLSessionTask* task, SEL _cmd, NSU
[NRMAHTTPUtilities attachPayload:payload
to:task.originalRequest];

// get response code
NSUInteger responseCode = [NRMAURLSessionTaskOverride statusCode:task.response];
if (responseCode != -1) {
NSData *data = NRMA__getDataForSessionTask(task);
NRMA__recordTask(task, data, task.response, task.error);
}
NSData *data = NRMA__getDataForSessionTask(task);
NRMA__recordTask(task, data, task.response, task.error);
}
}
}
Expand Down

0 comments on commit 1efe786

Please sign in to comment.