Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/oak/request.ts>Request#accepts

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
Very Popular
Go to Latest
method Request.prototype.accepts
import { Request } from "https://deno.land/x/oak@v17.0.0/request.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