mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-02 23:08:07 +08:00
22 lines
425 B
Go
22 lines
425 B
Go
package httpapi
|
|
|
|
import "net/http"
|
|
|
|
type transport struct {
|
|
header, value string
|
|
httptr http.RoundTripper
|
|
}
|
|
|
|
func newAuthenticatedTransport(tr http.RoundTripper, header, value string) *transport {
|
|
return &transport{
|
|
header: header,
|
|
value: value,
|
|
httptr: tr,
|
|
}
|
|
}
|
|
|
|
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
req.Header.Set(t.header, t.value)
|
|
return t.httptr.RoundTrip(req)
|
|
}
|