Skip to content

Type Method

enabled(initialByteBufferCapacity:disallowedTypes:allowRequestOverrides:)

Enables compression by default, but offers options to disallow it for the specified types.
static func enabled(initialByteBufferCapacity: Int = defaultInitialByteBufferCapacity, disallowedTypes: HTTPMediaTypeSet = .incompressible, allowRequestOverrides: Bool = true) -> HTTPServer.Configuration.ResponseCompressionConfiguration

Parameters

initialByteBufferCapacity

The initial buffer capacity to use when instantiating the compressor.

disallowedTypes

The types to prevent from being compressed. If unspecified, incompressible types will match, thus disabling compression for media types unless explicitly overriden. Specify none to enable compression for all types by default.

allowRequestOverrides

Allow routes and requests to explicitly disable compression. If unspecified, responses will be compressed by default unless routes or responses explicitly disable it. See ResponseCompressionMiddleware for more information.

Return Value

A response compression configuration.