Open mborsten opened 3 months ago
Maybe the response is cached on your client, so there is no body to capture and send to Proxyman.
Can you verify it?
You can test it by using no caching policy from URLSession
It is the request that has the empty body, not the response.
@mborsten can you share with me the log or any useful information that we can check?
For example:
I'd like to investigate it 👍
I'm having the same issue. This was working a week or two ago. Not sure what changed.
I even tried to rollback a caouple versions of Proxyman and Atlantis to no avail. Perhaps it's swizzling issue. Proxyman v4.16.0 from Jan 7 Atlantis v1.22.0
I think this is failing in atlantis, I've set a berakpoint and I can see that the body in the request of the message is nil. In the backend I do receive the body, so the request is OK:
@mborsten I guess the issue is from the Method Swizzling.
If you can set the breakpoint, can you trace back what URLSessionURLTask's method is called? I suppose that it's not URLSession.dataTaskWithURL:
or URLSession.dataTaskWithRequest
🤔
May I ask:
The content-type is 'application/json', I will try to get more information for you
@mborsten it's quite simple: J
I will try to investigate it 👍
@NghiaTranUIT method being called is URLSession.uploadTaskWithStreamedRequest
Nice. This API hasn't been implemented with the Method Swizzling yet. Let me support it 👍
@NghiaTranUIT Any update on when this will be added?
Not yet @mborsten I'm working on it now 👍
May I ask that you need to capture traffic from URLSession.uploadTaskWithStreamedRequest
too ?
@mooshee @mborsten may I ask:
URLSession.uploadTaskWithStreamedRequest
. Do you provide the Request Body via this delegate method: https://developer.apple.com/documentation/foundation/urlsessiontaskdelegate/1410001-urlsession ?request.httpBody = data
🤔 if you provide the body via: request.httpBody = data
I can make it work and send you a Beta build.
If it's from the delegate, I'm still looking for a solution. I tried, but It's hard to inject into its runtime.
I'm using [request setHTTPBodyStream: stream];
@mborsten I'm not sure how you can use request.httpBodyStream = ...
while using URLSession.uploadTaskWithStreamedRequest()
?
because I get this error:
The request of a upload task should not contain a body or a body stream, use `upload(for:fromFile:)`, `upload(for:from:)`, or supply the body stream through the `urlSession(_:needNewBodyStreamForTask:)` delegate method.
The body is ignored and other tools can't capture it.
Description
Some requests, not all, show as having an empty body in Proxyman when using Atlantis framework in an iOS project
Steps to Reproduce
[Atlantis startWithHostName:nil shouldCaptureWebSocketTraffic: NO];
Current Behavior
Sometimes the request shows an empty body, where there was data in the body. The response do show a body. This is not for all requests. The same request might or might not show a body when repeated/
Expected Behavior
All requests that have body data should show the body data in Proxyman.
Environment