root: initial merging of outpost and main project
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
20
internal/outpost/ak/api_uag.go
Normal file
20
internal/outpost/ak/api_uag.go
Normal file
@ -0,0 +1,20 @@
|
||||
package ak
|
||||
|
||||
import "net/http"
|
||||
|
||||
func SetUserAgent(inner http.RoundTripper, userAgent string) http.RoundTripper {
|
||||
return &addUGA{
|
||||
inner: inner,
|
||||
Agent: userAgent,
|
||||
}
|
||||
}
|
||||
|
||||
type addUGA struct {
|
||||
inner http.RoundTripper
|
||||
Agent string
|
||||
}
|
||||
|
||||
func (ug *addUGA) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
r.Header.Set("User-Agent", ug.Agent)
|
||||
return ug.inner.RoundTrip(r)
|
||||
}
|
||||
Reference in New Issue
Block a user