Module

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

Web Framework built on Web Standards
Very Popular
Go to Latest
variable accepts
import { accepts } from "https://dotland.deno.dev/x/hono@v4.2.6/helper/accepts/index.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