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.

Option to remove "charset=UTF-8" from Content-Type header

See original GitHub issue

Currently I’m using

fileUploadResponse = Unirest.post("https://httpbin.org/post")
  .field("key", "keyname")
  .field("name", "Testname")
  .field("type", "testtype")
  .field("file", file, "Testfile.testtype")
  .asString();

to upload a file as a POST request.

Because it adds “charset=UTF-8” in the Content-Type header the request could not be processed. So I have to use and very old version in gradle : "group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'" to fix this issue.

Is it possible to add an option to remove the encoding parameter in Content-Type header?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Serhiy-iLchenkocommented, Sep 21, 2020

Just had the same issue with PHP-based backed not pulling attachment into $_FILES unless I remove charset from Content-type. Please add something more obvious instead of null, like .noCharset()

0reactions
rybercommented, Sep 26, 2020

released in 3.11.00

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove charset=utf-8 in a Content-Type header ...
It took some debugging, but I found that HttpEncodingAutoConfiguration sets spring.http.encoding.force=true . If you set this to false in ...
Read more >
HttpClient: How to remove charset from ... - Gunnar Peipman
Removing charset from content-type header. Solution is simple – we can create StringContent with whatever encoding and then set charset to empty ...
Read more >
Remove charset from "Content-Type" header #184 - GitHub
Hello, I need to post some data to a distant API. But it looks like the API wants Content-Type: application/json but I'm sending...
Read more >
How to remove character encoding from the Content-Type ...
How to remove character encoding from the Content-Type header · Content-Type: application/json; charset=UTF-8 · Content-Type: application/json · <property name=" ...
Read more >
How to remove "charset=UTF-8" from Content-Type - MSDN
1. If Apache prefer a different charset, you could change it by setting the RequestEncoding on your client proxy. 2. If you do...
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