-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContentType for HttpClient request #635
Comments
Hi, @coolemza. Thanks for the report. |
@e5l Please, provide an example of content type setting for particular request (rather client). |
That is this fragment does work with 0.9.3, but not with > 0.9.3: val response = client.call(url) {
contentType(ContentType.Application.Json)
method = HttpMethod.Post
body = json.writeValueAsString(userData)
}.response |
Sure :) val response = client.call(url) {
method = HttpMethod.Post
body = TextContent(json.writeValueAsString(userData), contentType = ContentType.Application.Json)
}.response |
@soywiz could we have a sample for the case? |
is it possible to set default content type for engine? |
Yep. You could intercept send pipeline and wrap the body into outgoing content with selected |
I think the problem is obsolete for now. Closed |
@e5l What if you don't want to specify a The following also fails because it sets
|
how to setup contentType for HttpClient request?
this code throws exception:
io.ktor.http.UnsafeHeaderException: Header Content-Type is controlled by the engine and cannot be set explicitly
The text was updated successfully, but these errors were encountered: