/Knowledge/sources/honojs__hono/llms-full/method-override-middleware-for-example--e6bcac24a1ea.md
Method Override Middleware: For example - hono-docs
Method Override Middleware: For example Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt for example Su...
Method Override Middleware: For example
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#for-example
Summary
Since HTML forms cannot send a DELETE method, you can put the value DELETE in the property named _method and send it. And the handler for app.delete() will be executed. The HTML form: html The application: ```ts import { met...
Content
Since HTML forms cannot send a DELETE method, you can put the value DELETE in the property named _method and send it. And the handler for app.delete() will be executed.
The HTML form:
<form action="/posts" method="POST">
<input type="hidden" name="_method" value="DELETE" />
<input type="text" name="id" />
</form>
The application:
import { methodOverride } from 'hono/method-override'
const app = new Hono()
app.use('/posts', methodOverride({ app }))
app.delete('/posts', () => {
// ...
})
You can change the default values or use the header value and query value:
app.use('/posts', methodOverride({ app, form: '_custom_name' }))
app.use(
'/posts',
methodOverride({ app, header: 'X-METHOD-OVERRIDE' })
)
app.use('/posts', methodOverride({ app, query: '_method' }))
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#for-example",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Method Override Middleware > For example",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 179,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Method Override Middleware: For example",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}