Documentation
¶
Overview ¶
Package httputil implements common HTTP functionality used throughout the Clair codebase.
Index ¶
- func GetClientAddr(r *http.Request) string
- func GetWithContext(ctx context.Context, uri string, headers http.Header) (io.ReadCloser, error)
- func GetWithUserAgent(url string) (*http.Response, error)
- func PostWithUserAgent(url string, data interface{}) (*http.Response, error)
- func Status2xx(resp *http.Response) bool
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClientAddr ¶
GetClientAddr returns the first value in X-Forwarded-For if it exists otherwise fall back to use RemoteAddr
func GetWithContext ¶
GetWithContext do HTTP GET to the URI with headers and returns response blob reader.
func GetWithUserAgent ¶
GetWithUserAgent performs an HTTP GET with the proper Clair User-Agent.
func PostWithUserAgent ¶
PostWithUserAgent performs an HTTP POST with the proper Clair User-Agent.
Types ¶
Click to show internal directories.
Click to hide internal directories.