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

x/oak_commons/negotiation.ts>accepts

A set of APIs for handling HTTP and HTTPS requests with Deno 🐿️ 🦕
Very Popular
Go to Latest
function accepts
import { accepts } from "https://deno.land/x/oak_commons@0.3.1/negotiation.ts";

Returns an array of media types accepted by the request, in order of preference. If there are no media types supplied in the request, then any media type selector will be returned.

Returns

string[]

For a given set of media types, return the best match accepted in the request. If no media type matches, then the function returns undefined.

Parameters

request: Request
...types: string[]

Returns

string | undefined