Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

contentTypes

import { contentTypes } from "https://raw.githubusercontent.com/worker-tools/middleware/master/index.ts";

Performs content negotiation over the content type of the response.

function contentTypes<T extends string, TS extends readonly T[]>(types: TS): <X extends Context>(ax: Awaitable<X>) => Promise<X & ContentType<TS[number]>>;
§
contentTypes<T extends string, TS extends readonly T[]>(types: TS): <X extends Context>(ax: Awaitable<X>) => Promise<X & ContentType<TS[number]>>
[src]

§Type Parameters

§
T extends string
[src]
§
TS extends readonly T[]
[src]

§Parameters

§
types: TS
[src]

The content types provided by this endpoint.

§Return Type

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