std/http/negotiation.ts

Deno standard library
Go to Latest
function acceptsEncodings
import { acceptsEncodings } from "https://deno.land/std@0.147.0/http/negotiation.ts?s=acceptsEncodings";

Returns an array of content encodings accepted by the request, in order of preference. If there are no encoding supplied in the request, then ["*"] is returned, implying any encoding is accepted.

Returns

string[][src]

For a given set of content encodings, return the best match accepted in the request. If no content encodings match, then the function returns undefined.

NOTE: You should always supply identity as one of the encodings to ensure that there is a match when the Accept-Encoding header is part of the request.

Parameters

request: Request[src]
...encodings: string[][src]

Returns

string | undefined[src]

Parameters

request: Request[src]
...encodings: string[][src]

Returns

string | string[] | undefined[src]