Ktor Client: Is there anything built in that gener...
# ktor
b
Ktor Client: Is there anything built in that generates an HMAC over the request body and allows you to set the value as a header? I found StatelessHmacNonceManager but at least my understanding is that while it generates an HMAC, it's not generated over the request body
1
a
Unfortunately, there is no such built-in functionality in Ktor. You can intercept the
HttpSendPipeline
at the
Monitoring
phase (or create a hook) to get access to the request body before sending. In the handler, the request body can be cast to the non-streaming type
OutgoingContent.ByteArrayContent
to get the request body as a byte array. The code from the
StatelessHmacNonceManager
class can be used to generate an HMAC of the body and append it to the request as a header.
b
thank you
I went for an HttpSend plugin