Skip to content

Fix createAnonymousContext query parameter loss - #6050

Open
bun-unsafe wants to merge 1 commit into
eggjs:3.xfrom
bun-unsafe:fix/create-anonymous-context-query
Open

Fix createAnonymousContext query parameter loss#6050
bun-unsafe wants to merge 1 commit into
eggjs:3.xfrom
bun-unsafe:fix/create-anonymous-context-query

Conversation

@bun-unsafe

Copy link
Copy Markdown

Problem

app.createAnonymousContext(req) documents that callers can mock request values such as querystring, but Koa reads the query string from req.url. As a result, mocked query and querystring values were silently ignored.

const ctx = app.createAnonymousContext({ querystring: 'page=1&size=10' });
ctx.query;
// => {}

Fix

Normalize a supplied querystring or query object into the mocked request URL before creating the context. An explicitly supplied url remains authoritative.

Tests

Added regression coverage for:

  • querystring values
  • query object values
  • explicit URL precedence

The focused createAnonymousContext tests pass with 3 passing cases.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e49e012e-aecf-4d53-8d5d-1620f0278d2e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant