Skip to content

Make request path, body, and header semantics consistent across JS and native #22

Description

@yorkin-bot

Summary

The JS and native adapters currently construct materially different HttpRequest values for the same HTTP request.

Relevant code:

Confirmed differences

Query strings

With a registered GET /hello route:

  • native: GET /hello?x=1 returns 200, but the handler receives only /hello and cannot recover the query;
  • JS: GET /hello?x=1 returns 404 because routing uses the raw /hello?x=1.

PUT/PATCH bodies

An echo handler receives the request body on native. On JS, both PUT and PATCH have an empty raw_body because only POST subscribes to the Node data/end events.

Header casing

A handler using event.req.headers.get("X-Test") produced:

  • JS: missing whether the client sent x-test or X-Test (Node normalizes keys to lowercase);
  • native: value found only when the wire casing was exactly X-Test.

HTTP field names are case-insensitive, so application behavior must not depend on client casing or backend.

Expected behavior

Define one backend-independent request contract:

  • route using a parsed path, while retaining the query separately;
  • read framed bodies consistently for all applicable methods;
  • use an owned, case-insensitive header abstraction;
  • add the same request-conformance suite against JS and native adapters.

The exact public shape could be path + query, a parsed URI, or an explicit raw target, but handlers should receive equivalent information on both backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions