Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KSkyeEx opened this issue Apr 22, 2024 · 4 comments
Open
Labels
bug Something isn't working

Comments

@KSkyeEx
Copy link

KSkyeEx commented Apr 22, 2024

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
▿ some : ************/MaintenanceOrderDraft
▿ url : Optional
▿ some : ************/MaintenanceOrderDraft
- _url : /MaintenanceOrderDraft
- cachePolicy : 0
- timeoutInterval : 30.0
- mainDocumentURL : nil
- networkServiceType : __C.NSURLRequestNetworkServiceType
- allowsCellularAccess : true
▿ httpMethod : Optional
- 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
▿ some : 4001 bytes
- count : 4001
▿ pointer : 0x00000001602ab000
- pointerValue : 5908377600
- httpBodyStream : nil
- httpShouldHandleCookies : true
- httpShouldUsePipelining : false

(lldb) po sessionTask.currentRequest
▿ Optional
▿ some : **********/MaintenanceOrderDraft
▿ url : Optional
▿ some : **********/MaintenanceOrderDraft
- _url : /MaintenanceOrderDraft
- cachePolicy : 0
- timeoutInterval : 30.0
- mainDocumentURL : nil
- networkServiceType : __C.NSURLRequestNetworkServiceType
- allowsCellularAccess : true
▿ httpMethod : Optional
- 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
- some : <__NSCFInputStream: 0x282980480>
- httpShouldHandleCookies : true
- httpShouldUsePipelining : false

Expected Behavior

Environment

  • App version: Proxyman 5.2.0
  • macOS version: macOS 14.4.1
@KSkyeEx KSkyeEx added the bug Something isn't working label Apr 22, 2024
@NghiaTranUIT
Copy link
Member

@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
Copy link
Member

Might be releated to #1978 if you're using Stream Requests from URLSession.

@KSkyeEx
Copy link
Author

KSkyeEx commented Apr 23, 2024

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

@NghiaTranUIT
Copy link
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants