Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/workers_middleware/content-negotiation.ts>acceptsLanguages

Placeholder for Worker-based middleware solution
Latest
function acceptsLanguages
import { acceptsLanguages } from "https://deno.land/x/workers_middleware@v0.1.0-pre.36/content-negotiation.ts";

Determines if a request body content language is acceptable to this endpoint.

Type Parameters

T extends string
TS extends readonly T[]

Parameters

languages: TS

The languages (of the request body) acceptable to this endpoint.

Returns

<X extends Context>(ax: Awaitable<X>) => Promise<X & AcceptedLanguage<TS[number]>>