Marc Knaup
11/08/2018, 10:35 PM.receive<…>()
and ContentNegotiation
with GET
requests?
Since most clients can't sent a request entity along GET
requests (although theoretically possible) I'd like to add a ktor feature which
• takes two URL parameters like contentType=application/json
and entity={…}
(properly URL-encoded),
• modifies the Request
to return the value of query parameter contentType
as Content-Type
header and
• pass the value of the query parameter entity
as a ByteReadChannel
into the receivePipeline
.
Now ContentNegotiation
would properly pick them up and all .receive…()
functions work as expected (#theory).
Unfortunately context
(aka call
), call.request
and call.request.headers
are all immutable, so modifying the headers won't work.
So what else could I do to solve that issue without reinventing ContentNegotiation
or somehow simulating the a new pipeline to make it happy?