This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/internal/utils/web/http_user_agent.go
Jens Langhammer b6267fdf28 *: add versioned user agent to sentry
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2022-06-20 11:54:10 +02:00

20 lines
392 B
Go

package web
import (
"net/http"
)
type userAgentTransport struct {
inner http.RoundTripper
ua string
}
func NewUserAgentTransport(ua string, inner http.RoundTripper) *userAgentTransport {
return &userAgentTransport{inner, ua}
}
func (uat *userAgentTransport) RoundTrip(r *http.Request) (*http.Response, error) {
r.Header.Set("User-Agent", uat.ua)
return uat.inner.RoundTrip(r)
}