Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(level int, o ...Option) goa.Middleware
Middleware encodes the response using Gzip encoding and sets all the appropriate headers. If the Content-Type is not set, it will be set by calling http.DetectContentType on the data being written.
Types ¶
type Option ¶ added in v1.3.1
type Option func(*options) error
Option allows to override default parameters.
func AddContentTypes ¶ added in v1.3.1
func AddContentTypes(types ...string) Option
AddContentTypes allows to specify specific content types to encode. Adds to previous content types.
func AddStatusCodes ¶ added in v1.3.1
func AddStatusCodes(codes ...int) Option
AddStatusCodes allows to specify specific content types to encode. All content types that has the supplied prefixes are compressed.
func IgnoreRange ¶ added in v1.3.1
func IgnoreRange(b bool) Option
IgnoreRange will set make the compressor ignore Range requests. Range requests are incompatible with compressed content, so if this is set to true "Range" headers will be ignored. If set to false, compression is disabled for all requests with Range header.
func MinSize ¶ added in v1.3.1
func MinSize(n int) Option
MinSize will set a minimum size for compression.
func OnlyContentTypes ¶ added in v1.3.1
func OnlyContentTypes(types ...string) Option
OnlyContentTypes allows to specify specific content types to encode. Overrides previous content types. no types = ignore content types (always compress).
func OnlyStatusCodes ¶ added in v1.3.1
func OnlyStatusCodes(codes ...int) Option
OnlyStatusCodes allows to specify specific content types to encode. All content types that has the supplied prefixes are compressed. No codes = ignore content types (always compress).