What is the easiest way to have some function call...
# ktor
c
What is the easiest way to have some function called by the
HttpClient
on each outgoing request, which is able to modify the request (e.g. add a header)? It's just going to be used in tests, so it's not a problem if it's a bit of a hack My intuition is that plugins allow to do that, but I'm not familiar with them
l
There’s a header section of that plugin https://ktor.io/docs/default-request.html#headers
a
you can also use a custom plugin https://ktor.io/docs/custom-plugins.html#on-call
c
@Landry Norris I know about default request, but the header is different every time, that's why I want the ability to run code on each request
thanks @Alex Rouse, I'll read that
Sorry, the link you sent is for server-side plugins
Nevermind, it's in the same page