No request body for HTTP request is logged when enableCaptureFailedRequests=true
Platform
iOS
Environment
Develop, Production, TestFlight
Installed
Swift Package Manager
Version
8.35.0
Xcode Version
15.4
Did it work on previous versions?
No response
Steps to Reproduce
- Set up SentrySDK with enableCaptureFailedRequests=true
- Trigger an HTTP error on POST request or any other request with a body
Expected Result
Error is logged is full captured with request headers and body
Actual Result
No request body is being logged making the debugging impossible
Are you willing to submit a PR?
No response
Thanks @DataGreed for reaching out.
We will discuss what we can do about it, usually body requests contains PII and we need to make sure we're not sending any user information in the event.
As pointed out above, this is currently by design. We're gonna follow up internally if we want to allow this as opt-in guarded by some kind of flag to ensure users know that this opens up potentials PII/sensitive data issues.
In the mean time, you can get some inspiration from the following implementation on how to implement this yourself: https://github.com/getsentry/sentry-cocoa/blob/6ccaa36d280b21b1e304f3072707d31b9409346f/Sources/Sentry/SentryNetworkTracker.m#L407-L469