Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Sep 19, 2023
1 parent c3fb18d commit 7f84596
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,13 @@ void InstrumentUploadTaskWithRequestFromData(FPRNSURLSessionInstrument *instrume
}
typedef NSURLSessionUploadTask *(*OriginalImp)(id, SEL, NSURLRequest *, NSData *);
// To avoid a runtime warning in Xcode 15, the given `URLRequest`
// should have a nil `HTTPBody`. To workaround this, the `HTTPBody` data is removed.
// should have a nil `HTTPBody`. To workaround this, the `HTTPBody` data is removed
// and requestData is replaced with it, if it bodyData was `nil`.
NSMutableURLRequest *requestWithoutHTTPBody = [request mutableCopy];
NSData *requestData = bodyData ?: requestWithoutHTTPBody.HTTPBody;
requestWithoutHTTPBody.HTTPBody = nil;
NSURLSessionUploadTask *uploadTask =
((OriginalImp)currentIMP)(session, selector, requestWithoutHTTPBody, bodyData);
((OriginalImp)currentIMP)(session, selector, requestWithoutHTTPBody, requestData);
if (uploadTask.originalRequest) {
FPRNetworkTrace *trace =
[[FPRNetworkTrace alloc] initWithURLRequest:uploadTask.originalRequest];
Expand Down

0 comments on commit 7f84596

Please sign in to comment.