question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content-Type application/x-www-form-urlencoded by default

See original GitHub issue

Hi all!

I updated from 1.14.0 to 1.15.0 and had some issues with all my requests getting broken. Before I was just doing very basic JSON PUT requests, like this

val (request, response, result) = "http://myserver.local/api/v1/test".httpPut()
                .header("Content-Type" to "application/json")
                .body("{"id":"test","somemorefields":"andvalues", ...")
                .response()

with the latest Update to 1.15, this doesn’t work anymore. The Content-Type being sent is then “application/x-www-form-urlencoded; application/json” and my server rejects this.

Is this a nice default behaviour? I wouldn’t expect a default header to be set and my explicitly defined headers sent on the second position only (which makes everything fail now). I guess this whole implementation changed with https://github.com/kittinunf/Fuel/pull/393

Sidenote for anyone with the same problem: I figured out that the headers can be reset by wrapping them in a map

... .header(mapOf("Content-Type" to "application/json"))...

Kind Regards Matthias

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

1reaction
jackterranovacommented, Sep 5, 2018

Looks like Request.jsonBody is documented on the README.md, but this is not yet released correct?

0reactions
markGilchristcommented, Sep 5, 2018

True

Read more comments on GitHub >

github_iconTop Results From Across the Web

application/x-www-form-urlencoded or multipart/form-data?
application /x-www-form-urlencoded is the default mime-type of your request (see also w3.org/TR/html401/interact/forms.html#h-17.13.4). I use it ...
Read more >
Content-Type defaults to "application/x-www-form-urlencoded"
When no Content-Type is provided for POST, PATCH, PUT and default settings of the Fuel instance is applied, each of these requests defaults...
Read more >
Send Data by Using a POST Method - Micro Focus
The application/x-www-form-urlencoded content type describes form data that is sent in a single block in the HTTP message body. Unlike the query part...
Read more >
POST - HTTP - MDN Web Docs
A simple form using the default application/x-www-form-urlencoded content type: POST /test HTTP/1.1 Host: foo.example Content-Type: ...
Read more >
Difference Between form-data, x-www-form-urlencoded and ...
This is also known as the default content type. All the forms submitted with this content type follow the below encoding pattern: The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found