Skip to main content
Module

x/oak/mod.ts>Request#accepts

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Extremely Popular
Go to Latest
method Request.prototype.accepts
import { Request } from "https://deno.land/x/oak@v12.5.0/mod.ts";

Returns an array of media types, accepted by the requestor, in order of preference. If there are no encodings supplied by the requestor, then accepting any is implied is returned.

Returns

string[] | undefined

For a given set of media types, return the best match accepted by the requestor. If there are no encoding that match, then the method returns undefined.

Parameters

...types: string[]

Returns

string | undefined