Files
SnowLuma/.pnpm-store/v11/files/da/b577a5128c51b2be207ea397edac63a09825a4f3c2bc5613a5162cde3919c1e0e463ca9c92f28857a6c9ebdfae83720b8031e36b75b78787cd00e5578466c2
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

32 lines
883 B
Plaintext

import { AcceptHeader } from "../../utils/headers.js";
import { Context } from "../../context.js";
//#region src/helper/accepts/accepts.d.ts
export interface Accept {
type: string;
params: Record<string, string>;
q: number;
}
export interface acceptsConfig {
header: AcceptHeader;
supports: string[];
default: string;
}
export interface acceptsOptions extends acceptsConfig {
match?: (accepts: Accept[], config: acceptsConfig) => string;
}
export declare const defaultMatch: (accepts: Accept[], config: acceptsConfig) => string;
/**
* Match the accept header with the given options.
* @example
* ```ts
* app.get('/users', (c) => {
* const lang = accepts(c, {
* header: 'Accept-Language',
* supports: ['en', 'zh'],
* default: 'en',
* })
* })
* ```
*/
export declare const accepts: (c: Context, options: acceptsOptions) => string;
//#endregion