Skip to content

Taxum / @taxum/core / middleware/decompression / RequestDecompressionLayer

Class: RequestDecompressionLayer

Defined in: middleware/decompression.ts:22

A layer that decompresses request bodies.

Example

ts
import { RequestDecompressionLayer } from "@taxum/core/middleware/decompression";
import { m, Router } from "@taxum/core/routing";

const router = new Router()
    .route("/", m.get(() => "Hello World))
    .layer(new RequestDecompressionLayer());

Implements

Constructors

Constructor

new RequestDecompressionLayer(): RequestDecompressionLayer

Defined in: middleware/decompression.ts:32

Creates a new RequestDecompressionLayer.

By default, all encodings are accepted and unaccepted encodings are not passed through.

Returns

RequestDecompressionLayer

Methods

br()

br(enable): this

Defined in: middleware/decompression.ts:56

Sets whether to support Brotli encoding.

Parameters

enable

boolean

Returns

this


deflate()

deflate(enable): this

Defined in: middleware/decompression.ts:48

Sets whether to support Deflate encoding.

Parameters

enable

boolean

Returns

this


gzip()

gzip(enable): this

Defined in: middleware/decompression.ts:40

Sets whether to support gzip encoding.

Parameters

enable

boolean

Returns

this


layer()

layer(inner): HttpService

Defined in: middleware/decompression.ts:106

Wrap the given service with the middleware, returning a new service that has been decorated with the middleware.

Parameters

inner

HttpService

Returns

HttpService

Implementation of

Layer.layer


noBr()

noBr(): this

Defined in: middleware/decompression.ts:86

Disables support for Brotli encoding.

Returns

this


noDeflate()

noDeflate(): this

Defined in: middleware/decompression.ts:79

Disables support for Deflate encoding.

Returns

this


noGzip()

noGzip(): this

Defined in: middleware/decompression.ts:72

Disabled support for gzip encoding.

Returns

this


noZstd()

noZstd(): this

Defined in: middleware/decompression.ts:93

Disables support for Zstd encoding.

Returns

this


passThroughUnaccepted()

passThroughUnaccepted(enabled): this

Defined in: middleware/decompression.ts:101

Sets whether to pass through the request even when the encoding is not supported.

Parameters

enabled

boolean

Returns

this


zstd()

zstd(enable): this

Defined in: middleware/decompression.ts:64

Sets whether to support Zstd encoding.

Parameters

enable

boolean

Returns

this