Hi

I want to implement a client middleware - for example: sign the request 
body and add the signature as an HTTP header.
I thought that the best way to do it is to implement a RoundTripper 
interface <https://golang.org/pkg/net/http/#RoundTripper> which up on 
request, calculate the signature, adds the header, and invoke a "next" 
ToundTripper.

This could be a very generic implementation, which i can inject to any 
client that uses the standard library http.Client.

However, I found the following in the doc:

        // RoundTrip should not modify the request, except for
        // consuming and closing the Request's Body. RoundTrip may
        // read fields of the request in a separate goroutine. Callers
        // should not mutate the request until the Response's Body has
        // been closed.


Is there a standard way to do it?

Thanks,
Eyal

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to