-
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
Client silently ignoring http method #851
Comments
Hi @sellmair, it looks like the side effect from Could you reproduce it with |
I noticed a similar effect which could explain the The I think it's totally valid to have another guard to check the payload instance here. Something like: if (payload is OutgoingContent) {
return@intercept
} Not sure if this solves your problem, I have written the following workaround class IgnoreOutgoingContentJsonSerializer(private val delegate: JsonSerializer) : JsonSerializer by delegate {
override fun write(data: Any): OutgoingContent {
if (data is OutgoingContent) {
return data
}
return delegate.write(data)
}
}
fun JsonSerializer.ignoreOutgoingContent() = IgnoreOutgoingContentJsonSerializer(this)
val client = HttpClient(OkHttp) {
install(JsonFeature) {
serializer = KotlinxSerializer().ignoreOutgoingContent()
}
} |
Ktor Version
1.1.1
Ktor Engine Used(client or server and name)
Netty, Client
JVM Version, Operating System and Relevant Context
Android, Multiplatform
Feedback
Declaration of client
Declaration of request:
Results in
Declaration of request with body
Still sends a post request to the server.
Ktor server side logging:
The text was updated successfully, but these errors were encountered: