fix: CFNetwork upload warning setting body twice #240
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
[NSURLSession uploadTaskWithRequest:fromData:]
if the request passed in already has its body set. In this case, we set the same data as theHTTPBody
property of the request that we pass in to that method, so in the end the call worked fine, but now warns that we're setting it twice. Since we always set the post body on the request when we call[MPURLRequestBuilder build]
on line 246, I've switched to using the more correct[NSURLSession dataTaskWithRequest]
which just uses the HTTPBody from the request instead of the data we pass in. This works exactly the same, but fixes the warning.Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)