clair: Index | Files

package httputil

import ""

Package httputil implements common HTTP functionality used throughout the Clair codebase.


Package Files


func GetClientAddr Uses

func GetClientAddr(r *http.Request) string

GetClientAddr returns the first value in X-Forwarded-For if it exists otherwise fall back to use RemoteAddr

func GetWithContext Uses

func GetWithContext(ctx context.Context, uri string, headers http.Header) (io.ReadCloser, error)

GetWithContext do HTTP GET to the URI with headers and returns response blob reader.

func GetWithUserAgent Uses

func GetWithUserAgent(url string) (*http.Response, error)

GetWithUserAgent performs an HTTP GET with the proper Clair User-Agent.

func Status2xx Uses

func Status2xx(resp *http.Response) bool

Status2xx returns true if the response's status code is success (2xx)

type Middleware Uses

type Middleware func(http.Handler) http.Handler

Middleware is a function used to wrap the logic of another http.Handler.

Package httputil imports 8 packages (graph) and is imported by 9 packages. Updated 2019-03-03. Refresh now. Tools for package owners.