Skip to content

POST to an unknown /api route returns misleading 405 "Static assets are GET-only." #15

Description

@ahmad-ajmal

Summary

A non-GET request to an API path the adapter doesn't route falls through to the static View handler. That handler answers 405 "Static assets are GET-only." The message sends the caller (usually an agent writing frontend code) looking in the wrong place.

Seen in practice: the agent wired a frontend button to POST /api/_a2app/operate, which doesn't exist, and got:

Static assets are GET-only.

The real endpoint is POST /api/ops/<operation-name>. The error neither says the route doesn't exist nor points to it.

Where

  • adapters/adapter-core/src/static.ts:199-205: any method other than GET/HEAD returns method_not_allowed before the path is checked.
  • The same behaviour exists in toolkits/blueprint-go-react/template/main.go:385 and toolkits/blueprint-rust-react/template/src/main.rs:607.

Suggested fix

  • Unmatched requests under /api/ (and especially /api/_a2app/) should return 404 unknown_route from the adapter instead of reaching the static handler. For POSTs, include a hint such as: Operations are invoked with POST /api/ops/<name>; see /api/_a2app/describe for the list.
  • The static handler should return 405 only for paths that actually resolve to a static file. Otherwise it should 404.
  • Add adapter-core and blueprint tests: POST /api/_a2app/does-not-exist → 404 with the hint; POST /index.html → 405.

Activity

  1. self-assigned this
    on Oct 1, 2026
  2. ahmad-ajmal commented on Oct 2, 2026

    @ahmad-ajmal
    CollaboratorAuthor

    Fixed in PR #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions