Files
SnowLuma/.pnpm-store/v11/files/c2/009ca75c9713890971995adb535abc6cce037e3bd7244d7632b6ad013a3e2c1f7845495c602340702f907d2029ed21791e38eb8ee7e6fe5c8e05ccd56225f9
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

47 lines
1.4 KiB
Plaintext

import { MiddlewareHandler } from "../../types.js";
import { Hono } from "../../hono.js";
//#region src/middleware/method-override/index.d.ts
type MethodOverrideOptions = {
app: Hono<any, any, any>;
} & ({
form?: string;
header?: never;
query?: never;
} | {
form?: never;
header: string;
query?: never;
} | {
form?: never;
header?: never;
query: string;
});
/**
* Method Override Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/method-override}
*
* @param {MethodOverrideOptions} options - The options for the method override middleware.
* @param {Hono} options.app - The instance of Hono is used in your application.
* @param {string} [options.form=_method] - Form key with a value containing the method name.
* @param {string} [options.header] - Header name with a value containing the method name.
* @param {string} [options.query] - Query parameter key with a value containing the method name.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* // If no options are specified, the value of `_method` in the form,
* // e.g. DELETE, is used as the method.
* app.use('/posts', methodOverride({ app }))
*
* app.delete('/posts', (c) => {
* // ....
* })
* ```
*/
export declare const methodOverride: (options: MethodOverrideOptions) => MiddlewareHandler;
//#endregion
export {};