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.

Getting error when using @FormUrlEncoded

See original GitHub issue

Describe 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:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Tlastercommented, Jun 7, 2022

@Tlaster have you been able to overcome this issue yet?

No, our team end up creating a new one that just generates ktor call without any runtime: https://github.com/qdsfdhvh/ktor-fit

1reaction
gazanfarovcommented, Jun 13, 2022

@Foso just noticed new commit and here you are. God speed! 🤓 Going to check it today, thank you!

Update: everything works now.

Read more comments on GitHub >

github_iconTop 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 >

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