Client-side fetch HTTP methods match handler exports
Why it matters
A client calls fetch('/api/posts', { method: 'DELETE' }) but the route handler at app/api/posts/route.ts only exports GET and POST. Next.js and every other App Router framework respond with HTTP 405 Method Not Allowed — the server is reachable, the path resolves, but the method is refused. This is a reference-integrity failure that neither the bundler nor tsc can catch because HTTP methods are stringly-typed, and the error only surfaces when the user clicks the delete button.
Severity rationale
High because a 405 response breaks a user-facing action at runtime and no build step catches the mismatch.
Remediation
Add the missing method export to the route handler so the server accepts the request shape the client sends. Open the route file and export a named function per method:
// app/api/posts/route.ts
export async function GET() { /* ... */ }
export async function POST() { /* ... */ }
export async function DELETE() { /* ... */ }
Or change the client to use a method the handler already exports.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Hallucinated References Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-hallucinations·automated