Skip to content

feat(http): separate request path and query string for endpoint routing - #28

Open
GreyPikachu wants to merge 2 commits into
RomanSnitko:mainfrom
GreyPikachu:feat/http-query-parsing
Open

GreyPikachu wants to merge 2 commits into
RomanSnitko:mainfrom
GreyPikachu:feat/http-query-parsing

Conversation

@GreyPikachu

Copy link
Copy Markdown

Description

This pull request extracts the request URL path and query string separately in HttpRequest and routes endpoints based on the path.

Motivation

Previously, Reactor::Route compared request.target directly against route literals (e.g. request.target == "/processes"). If an HTTP client appended a query string (such as curl http://localhost:8080/processes?filter=worker), the server failed with a 404 not_found because the query parameters were part of target. Separating path and query enables URL query parameters on all HTTP endpoints without route mismatches.

Changes

  • server/http: Added path and query fields to HttpRequest and split target at ?.
  • server/transport: Updated Reactor::Route to match against request.path.
  • tests/core: Added test case in TestHttp validating query string separation.

Verification

  • Verified with unit tests in TestHttp: query strings like GET /processes?filter=web now resolve to 200 with parsed path and query.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants