Is there a ktor-client plugin that adds set of def...
# ktor
d
Is there a ktor-client plugin that adds set of default headers such as Date (counterpart to server plugin DefaultHeaders)?
c
d
I found that, but there doesnt seem to be option to add Date header?
b
Copy code
defaultRequest {
    header("X-Date", "${Instant.now()}")
}
You can use something like this. Or are you looking for something else?
d
I wanted standard Date header, I thought the client would add one by default https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date
Ok, I solved it by
Copy code
defaultRequest{
    header(HttpHeaders.Date, GMTDate().toHttpDate())
}