Documentation ¶
Index ¶
- Variables
- func DetectContentType(c []byte) (string, map[string]string, error)
- func Download(url string) (resp *http.Response, err error)
- func NewHTTPRequestError(msg string, res *http.Response) error
- func ResumableRequestReader(c *http.Client, r *http.Request, maxfail uint32, totalsize int64) io.ReadCloser
- func ResumableRequestReaderWithInitialResponse(c *http.Client, r *http.Request, maxfail uint32, totalsize int64, ...) io.ReadCloser
- type ServerHeader
Constants ¶
This section is empty.
Variables ¶
var MimeTypes = struct { TextPlain string Tar string OctetStream string }{"text/plain", "application/tar", "application/octet-stream"}
MimeTypes stores the MIME content type.
Functions ¶
func DetectContentType ¶ added in v1.8.0
DetectContentType returns a best guess representation of the MIME content type for the bytes at c. The value detected by http.DetectContentType is guaranteed not be nil, defaulting to application/octet-stream when a better guess cannot be made. The result of this detection is then run through mime.ParseMediaType() which separates the actual MIME string from any parameters.
func NewHTTPRequestError ¶ added in v1.7.0
NewHTTPRequestError returns a JSON response error.
func ResumableRequestReader ¶
func ResumableRequestReader(c *http.Client, r *http.Request, maxfail uint32, totalsize int64) io.ReadCloser
ResumableRequestReader makes it possible to resume reading a request's body transparently maxfail is the number of times we retry to make requests again (not resumes) totalsize is the total length of the body; auto detect if not provided
func ResumableRequestReaderWithInitialResponse ¶
func ResumableRequestReaderWithInitialResponse(c *http.Client, r *http.Request, maxfail uint32, totalsize int64, initialResponse *http.Response) io.ReadCloser
ResumableRequestReaderWithInitialResponse makes it possible to resume reading the body of an already initiated request.
Types ¶
type ServerHeader ¶ added in v1.8.0
type ServerHeader struct { App string // docker Ver string // 1.8.0-dev OS string // windows or linux }
ServerHeader contains the server information.
func ParseServerHeader ¶ added in v1.8.0
func ParseServerHeader(hdr string) (*ServerHeader, error)
ParseServerHeader extracts pieces from an HTTP server header which is in the format "docker/version (os)" eg docker/1.8.0-dev (windows).