With Ktor Server, is their any way to rewrite a he...
# ktor
j
With Ktor Server, is their any way to rewrite a header already written before?
Copy code
call.response.header("foo", "bar")
call.response.header("foo", "baz")
This code returns a response with header
foo: bar
instead of
foo: baz
.
c
in HTTP headers can be set more than once - they can have multiple values. Its likely your response has both “foo” headers in it (you’ll need to see the raw response via
curl -v
or somesuch, as lots of clients/libraries only pull out one of the headers). Its not really possible to “remove” a response header as it may already have been sent on the network.
j
I’m not sure about the network part, since the
append
method is not suspending. However, you’re right, the header is just probably sent multiple times.
👍 1