Getting error when using @FormUrlEncoded
See original GitHub issueDescribe the bug
When using @FormUrlEncoded
, ktor will throw an error io.ktor.http.UnsafeHeaderException: Header(s) [Content-Type] are controlled by the engine and cannot be set explicitly
, I think it’s a limitation from ktor since there’s already an issue about it. But I haven’t got a solution yet.
To Reproduce
Steps to reproduce the behavior:
Make an api interface with @FormUrlEncoded
Expected behavior
We can make @FormUrlEncoded
request
Software used
Android Studio Electric Eel | 2022.1.1 Canary 2
Build #AI-213.7172.25.2211.8571212, built on May 11, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
Manjaro
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Solved: application/x-www-form-urlencoded content type err...
The problem with the webhook is that it sends the payload with a content type of application/x-www-form-urlencoded. I'm now getting this weird error...
Read more >java - Error parsing application/x-www-form-urlencoded with ...
According to my research, the correct way to handle Unicode in a application/x-www-form-urlencoded body is to translate the Unicode to bytes ...
Read more >Content Type x-www-form-urlencoded in API call causes 500 ...
If a user sends an API request and provides the Content-Type "application/x-www-form-urlencoded" an 500 Error is thrown in ASP.NET Core.
Read more >Consume Rest API x-www-form-urlencoded - Getting Error 422
I am trying to get token. In postman and service studio test API, works fine! Getting token, but in runtime is not working....
Read more >Problem sending application/x-www-form-urlencoded ... - IBM
While sending same request to back end using dp:url-open I am getting 400-bad request with JSON response. is there any problem sendingcontent-type asapplication ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No, our team end up creating a new one that just generates ktor call without any runtime: https://github.com/qdsfdhvh/ktor-fit
@Foso just noticed new commit and here you are. God speed! 🤓 Going to check it today, thank you!
Update: everything works now.