package
1.5.0
Repository: https://github.com/m3db/m3.git
Documentation: pkg.go.dev

# Packages

Package cors handles cross-origin HTTP requests (CORS).

# Functions

DefaultHTTPClientOptions returns default options.
DurationToNanosBytes transforms a json byte slice with Duration keys into Nanos.
DurationToNanosMap transforms keys with a Duration into Nanos.
IsClientError returns true if this error would result in 4xx status code.
NanosToDurationBytes transforms a json byte slice with Nano keys into Duration keys.
NanosToDurationMap transforms keys with Nanos into Duration.
NewError creates a new error with an explicit status code which will override any wrapped error to return specifically the exact error code desired.
NewHTTPClient constructs a new HTTP Client.
SetErrorRewriteFn sets error rewrite function.
WithErrorResponse specifies a response to add the WriteError method.
WriteError will serve an HTTP error.
WriteJSONResponse writes generic data to the ResponseWriter.
WriteProtoMsgJSONResponse writes a protobuf message to the ResponseWriter.
WriteUninitializedResponse writes a protobuf message to the ResponseWriter.

# Constants

ContentTypeFormURLEncoded is the Content-Type value for a URL-encoded form.
ContentTypeHTMLUTF8 is the Content-Type value for UTF8-encoded HTML.
ContentTypeJSON is the Content-Type value for a JSON response.
ContentTypeOctetStream is the Content-Type value for binary data.
ContentTypeProtobuf is the Content-Type value for a Protobuf message.
HeaderContentType is the HTTP Content Type header.

# Structs

ErrorResponse is a generic response for an HTTP error.
HTTPClientOptions specify HTTP Client options.

# Interfaces

Error is an HTTP JSON error that also sets a return status code.

# Type aliases

ErrorRewriteFn is a function for rewriting response error.
ProxyFunc is a type alias for the proxy function used by the standard library's http.Transport struct.
WriteErrorOption is an option to pass to WriteError.