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

x/hono/helper/accepts/accepts.ts>accepts

Fast, Lightweight, Web-standards
Very Popular
Go to Latest
variable accepts
import { accepts } from "https://deno.land/x/hono@v4.0.9/helper/accepts/accepts.ts";

Match the accept header with the given options.

Examples

Example 1

app.get('/users', (c) => {
  const lang = accepts(c, {
    header: 'Accept-Language',
    supports: ['en', 'zh'],
    default: 'en',
  })
})

type

(c: Context, options: acceptsOptions) => unknown