Skip to content

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

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

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
    ]);
}

AutoCompress

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:149

Parameters

options?

CompressionOptions

Returns

AutoCompress

Properties

options

ts
options: Required<CompressionOptions> & object;

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

Type declaration

constraints
ts
constraints: Required<Constraints>;

Methods

request()

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

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

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

context

RequestContext

next

NextFn<T>

Returns

| Promise<T> | Future<T>

Implementation of

Handler.request

Released under the MIT License.