khttp icon indicating copy to clipboard operation
khttp copied to clipboard

Content-Type header is overwritten.

Open MrThreepwood opened this issue 5 years ago • 3 comments

It makes sense to set this for the user if they haven't provided it, but the fact that someone has provided data as a string does not make the content type text/plain. I was attempting to use this library to test some Graphql endpoints and unfortunately can't do it because of this.

MrThreepwood avatar Jan 03 '20 21:01 MrThreepwood

It worked in the latest version for me!

felipehjcosta avatar Jan 13 '20 20:01 felipehjcosta

I believe we've switched over to okhttp internally, feel free to close this if it's not an issue.

MrThreepwood avatar Mar 16 '20 21:03 MrThreepwood

Is it that what you're doing?

val graphql = "{\"query\":\"query { viewer { login } }\",\"variables\":{}}"
post("http://localhost:8080", data = graphql, headers = mapOf("Content-Type" to "application/json"))

Zemke avatar Jun 12 '20 19:06 Zemke