I have anumber HttpClient instances that I want to...
# ktor
h
I have anumber HttpClient instances that I want to apply outgoing header
CallId
for and I would like avoid setting it everywhere. I have tried extending it like:
Copy code
suspend inline fun HttpClient.get(url: String): HttpResponse {
        return get(url) {
            headers {
                append(HttpHeaders.XRequestId, MDC.get("CallId"))
            }
        }
    }
But that does not allow for setting other headers that are needed in only a few places. Is there a way to always set a particular header like this one which is per request but still allow for more customization of the headers or other properties in specific call sites?
a
The DefaultRequest plugin should help.
h
Thanks that looks precisely like what I would need!