pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.32k stars 184 forks source link

Request body is always empty #84

Closed omiz closed 4 years ago

omiz commented 4 years ago

The request body always displayed as "-" even when there is body

I'm using version: 1.6.0

pmusolino commented 4 years ago

It's a multipart request? It is the first time that I get this feedback.

omiz commented 4 years ago

I'm not sure if it's the first time you're getting this but it's the first time I'm reporting this issue

in short none of the requests that I have shows the body

so I'm building a URLRequest and setting the httpBody on it using a string after converting it to data. the httpMethod is POST

I was also looking at the body from google analytics, Crashlytics and some other requests nothing is having any body it always shows minus "-"

I'm not sure if this helps but I'm running on iPad with iPadOS 13.4.1

pmusolino commented 4 years ago

If you downgrade to the release 1.5.2 you are able to see the requests?

omiz commented 4 years ago

I can see the request body if I downgraded to 1.5.2 but it seems like the request is being duplicated multiple times now like if it's stuck in a loop or something

pmusolino commented 4 years ago

This is super strange! Since I'm not able to replicate the issue, can I ask you a demo project where you are able to replicate the problem systematically? You can fork the library, use the demo project of Wormholy, and modify it to be similar to your API calls. 🙇

pmusolino commented 4 years ago

Seems that I'm able to replicate the issue also on Wormholy demo project. Seems that the Task finished with error The request timed out. In your case, is the request executed correctly?

omiz commented 4 years ago

The API is private and work related I'm sorry but I can't share it

but it's an API where the url and path are the same but the request body is deferent (SOAP API) The duplicated request has many timeouts but I'm guessing that's because all of them are started at the same time (since the seconds and minutes match in all of them)

the first request is going through fine

pmusolino commented 4 years ago

I did not intend to use your private APIs, but to configure the APIs used by Wormholy (public) using the same settings used by you.

omiz commented 4 years ago

ok so here is what I can share I know it's not much

I use alamofire (5.1.0) to create a request with base authentication and configuration as below

let configuration: URLSessionConfiguration

configuration.httpShouldUsePipelining = true

configuration.httpMaximumConnectionsPerHost = 1

configuration.shouldUseExtendedBackgroundIdleMode = true

configuration.waitsForConnectivity = true

configuration.networkServiceType = .background

configuration.timeoutIntervalForRequest = 60 * 5

var request = URLRequest(url: url)

let xml: String = """
<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' 
    xmlns:xmlmime='http://www.w3.org/2004/11/xmlmime'>
    <soap:Body>
    </soap:Body>
</soap:Envelope>
"""

if let data = xml.data(using: .utf8) {
    request.httpBody = data
}

request.httpMethod = "POST"

let basicAuthHeader = HTTPHeader.authorization(
    username: basicAuthenticationUser,
    password: basicAuthenticationPassword
)

request.headers.add(basicAuthHeader)
request.headers.add(HTTPHeader.contentType("text/xml"))

AlamofireSession.request(request).response(queue: .global(qos: .background), completionHandler: { response in

})

this is just to understand the process I'm not sure how to build a demo from it without making the server public

andrii-krit commented 4 years ago

+1 same issue here, body is empty for every request

jameshays commented 4 years ago

I'm seeing this issue as well in 1.6.1. It is working in 1.5.2

ricardohochman commented 4 years ago

Any update on this issue? I'm facing the same problem. All request bodies are empty.

pmusolino commented 4 years ago

I'm investigating on it 👍

pmusolino commented 4 years ago

Fixed in release 1.6.2 https://github.com/pmusolino/Wormholy/releases/tag/1.6.2 👍

MoKeS- commented 3 years ago

Seems to be broken again since the tag 1.6.3 ? cc @pmusolino

akovalov commented 3 years ago

@pmusolino body parameters are broken in 1.6.3, it's ok in 1.6.2