import { methodOverride } from "https://deno.land/x/hono@v4.2.1/middleware/method-override/index.ts";
Method Override Middleware
Examples
// with form input method
const app = new Hono()
app.use('/books/', methodOverride({ app })) // the default form
value is _method
app.use('/authors/', methodOverride({ app, form: 'method' }))
// with form input method
const app = new Hono()
app.use('/books/', methodOverride({ app })) // the default form
value is _method
app.use('/authors/', methodOverride({ app, form: 'method' }))
// with custom header
app.use('/books/*', methodOverride({ app, header: 'X-HTTP-METHOD-OVERRIDE' }))
// with custom header app.use('/books/*', methodOverride({ app, header: 'X-HTTP-METHOD-OVERRIDE' }))
// with query parameter
app.use('/books/*', methodOverride({ app, query: '_method' }))
// with query parameter app.use('/books/*', methodOverride({ app, query: '_method' }))
type
(options: MethodOverrideOptions) => MiddlewareHandler