Proxyman icon indicating copy to clipboard operation
Proxyman copied to clipboard

When using Atlantis, the request body occasionally appears empty in Proxyman

Open KSkyeEx opened this issue 1 year ago • 4 comments

Description

When using Atlantis, the request body occasionally appears empty in Proxyman I see that the data in originalRequest and currentRequest are different I used ****** instead of * * * for the privacy related part

Steps to Reproduce

(lldb) po sessionTask.originalRequest ▿ Optional<URLRequest> ▿ some : ************/MaintenanceOrderDraft ▿ url : Optional<URL> ▿ some : ************/MaintenanceOrderDraft - _url : /MaintenanceOrderDraft - cachePolicy : 0 - timeoutInterval : 30.0 - mainDocumentURL : nil - networkServiceType : __C.NSURLRequestNetworkServiceType - allowsCellularAccess : true ▿ httpMethod : Optional<String> - some : "POST" ▿ allHTTPHeaderFields : Optional<Dictionary<String, String>> ▿ some : 9 elements ▿ 0 : 2 elements - key : "version" - value : "1.9.0" ▿ 1 : 2 elements - key : "User-Agent" - value : "/1.9.0 (iPhone; iOS 15.4; Scale/2.00)" ▿ 2 : 2 elements - key : "Accept-Language" - value : "zh-Hans-CN;q=1" ▿ 3 : 2 elements - key : "model" - value : "iPhone" ▿ 4 : 2 elements - key : "lang" - value : "zh-CN" ▿ 5 : 2 elements - key : "deviceName" - value : "iPhone 6s" ▿ 6 : 2 elements - key : "Authorization" - value : "29bd6ac6-a0a2-493d-bcae-adce6e4f9c67" ▿ 7 : 2 elements - key : "systemVersion" - value : "15.4" ▿ 8 : 2 elements - key : "Content-Type" - value : "application/json" ▿ httpBody : Optional<Data> ▿ some : 4001 bytes - count : 4001 ▿ pointer : 0x00000001602ab000 - pointerValue : 5908377600 - httpBodyStream : nil - httpShouldHandleCookies : true - httpShouldUsePipelining : false

(lldb) po sessionTask.currentRequest ▿ Optional<URLRequest> ▿ some : **********/MaintenanceOrderDraft ▿ url : Optional<URL> ▿ some : **********/MaintenanceOrderDraft - _url : /MaintenanceOrderDraft - cachePolicy : 0 - timeoutInterval : 30.0 - mainDocumentURL : nil - networkServiceType : __C.NSURLRequestNetworkServiceType - allowsCellularAccess : true ▿ httpMethod : Optional<String> - some : "POST" ▿ allHTTPHeaderFields : Optional<Dictionary<String, String>> ▿ some : 10 elements ▿ 0 : 2 elements - key : "Accept-Language" - value : "zh-Hans-CN;q=1" ▿ 1 : 2 elements - key : "systemVersion" - value : "15.4" ▿ 2 : 2 elements - key : "lang" - value : "zh-CN" ▿ 3 : 2 elements - key : "model" - value : "iPhone" ▿ 4 : 2 elements - key : "User-Agent" - value : "/1.9.0 (iPhone; iOS 15.4; Scale/2.00)" ▿ 5 : 2 elements - key : "version" - value : "1.9.0" ▿ 6 : 2 elements - key : "Content-Length" - value : "4001" ▿ 7 : 2 elements - key : "Authorization" - value : "29bd6ac6-a0a2-493d-bcae-adce6e4f9c67" ▿ 8 : 2 elements - key : "Content-Type" - value : "application/json" ▿ 9 : 2 elements - key : "deviceName" - value : "iPhone 6s" - httpBody : nil ▿ httpBodyStream : Optional<NSInputStream> - some : <__NSCFInputStream: 0x282980480> - httpShouldHandleCookies : true - httpShouldUsePipelining : false

Expected Behavior

Environment

  • App version: Proxyman 5.2.0
  • macOS version: macOS 14.4.1

KSkyeEx avatar Apr 22 '24 03:04 KSkyeEx

@KSkyeEx can you share with me what method from URLSession that you're using? For example: dataTask(with:).

If the body is missing, it indicates that this a new APIs that Atlantis has not covered yet.

NghiaTranUIT avatar Apr 22 '24 04:04 NghiaTranUIT

Might be releated to https://github.com/ProxymanApp/Proxyman/issues/1978 if you're using Stream Requests from URLSession.

NghiaTranUIT avatar Apr 22 '24 04:04 NghiaTranUIT

image image image 我发现当currentrequest 里的 httpbody 丢失的时候,他的数据体其实是在 httpstream ,我不知道这是不是和重定向有关系,我暂时使用originrequest 来代替 currentrequest 来工作

KSkyeEx avatar Apr 23 '24 02:04 KSkyeEx

@KSkyeEx It's a known-issues of Atlantis, It can't capture Request Body if it's from httpStream. Similar as the above ticket.

I'm working on it.

To workaround, you can use the common func that Atlantis supports, such as: https://developer.apple.com/documentation/foundation/urlsession/1410592-datatask

You can set the httpBody in the URLRequest

NghiaTranUIT avatar Apr 25 '24 01:04 NghiaTranUIT