Skip to content

Documentation / @ember-data/request-utils / handlers / AutoCompress

Class: AutoCompress

Defined in: warp-drive-packages/utilities/declarations/-private/handlers/auto-compress.d.ts:151

A request handler that automatically compresses the request body if the request body is a string, array buffer, blob, or form data.

This uses the CompressionStream API

The compression format as well as the kinds of data to compress can be configured using the format and constraints options.

diff
+import { AutoCompress } from '@ember-data/request-utils/handlers';
import Fetch from '@ember-data/request/fetch';
import RequestManager from '@ember-data/request';
import Store from '@ember-data/store';

class AppStore extends Store {
  requestManager = new RequestManager()
    .use([
+       new AutoCompress(),
       Fetch
    ]);
}

Since

5.5.0

Implements

Constructors

Constructor

ts
new AutoCompress(options?): AutoCompress;

Defined in: warp-drive-packages/utilities/declarations/-private/handlers/auto-compress.d.ts:155

Parameters

options?

CompressionOptions

Returns

AutoCompress

Methods

request()

ts
request<T>(__namedParameters, next): 
  | Promise<T>
| Future<T>;

Defined in: warp-drive-packages/utilities/declarations/-private/handlers/auto-compress.d.ts:156

Method to implement to handle requests. Receives the request context and a nextFn to call to pass-along the request to other handlers.

Type Parameters

T

T

Parameters

__namedParameters

RequestContext

next

NextFn<T>

Returns

| Promise<T> | Future<T>

Implementation of

Handler.request

Properties

options

ts
options: Required<CompressionOptions> & object;

Defined in: warp-drive-packages/utilities/declarations/-private/handlers/auto-compress.d.ts:152

Type declaration

constraints
ts
constraints: Required<Constraints>;

Released under the MIT License.