Hi, I wrote a HttpClient plugin to change the auth header for some requests; so far so good. I do no...
b
Hi, I wrote a HttpClient plugin to change the auth header for some requests; so far so good. I do not want the user to get the session cookie, so I want to strip the "set-cookie" header from the response. The headers in the response object are read-only. Is there a location (intercept) somewhere where I could change the response headers?
Copy code
scope.requestPipeline.intercept(HttpRequestPipeline.State) {
   // inject auth header here - works fine
   val clientCall = proceedWith(subject)
   // Remove session cookie here - don't know how to do this
}
r
There is no simple way to do it, but it’s possible. You can get an idea from this test https://github.com/ktorio/ktor/blob/main/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/ClientPipelinesTest.kt#L22
1
b
Yes that works. Thanks!