Skip to content

fix(sandbox): support conditional request injections#452

Merged
miclle merged 1 commit into
qiniu:masterfrom
miclle:codex/sandbox-injection-conditions
Jul 6, 2026
Merged

fix(sandbox): support conditional request injections#452
miclle merged 1 commit into
qiniu:masterfrom
miclle:codex/sandbox-injection-conditions

Conversation

@miclle

@miclle miclle commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add sandbox request injection types for baseUrl, ifHeaders, and ifQueries
  • normalize camelCase conditional injection fields before sending API requests
  • fix Qiniu-auth GET signing for bodyless sandbox requests by aligning the default content type
  • update injection examples, changelog, and type/unit coverage

Validation

  • npm run test:sandbox
  • npm run check-type
  • npx eslint qiniu/sandbox/client.js test/sandbox_client.test.js examples/sandbox_injection_rules.js examples/sandbox_request_injections.js
  • NODE_ENV=test npx mocha -t 600000 --retries 0 test/sandbox_integration.test.js
  • node examples/sandbox_request_injections.js
  • node examples/sandbox_injection_rules.js

Add conditional request injection fields to the sandbox SDK types and camelCase normalization path. Also align Qiniu-auth GET signing with the default content type used by the HTTP client, and cover the behavior with tests and examples.
@qiniu-prow qiniu-prow Bot added the size/L label Jul 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for baseUrl path prefix matching, as well as ifHeaders and ifQueries condition matching for sandbox request injections. It updates the TypeScript type definitions, client normalization logic, examples, and test coverage. It also ensures that the Content-Type header is removed for GET and HEAD requests without a body to allow correct default signing. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@miclle
miclle marked this pull request as ready for review July 6, 2026 03:23
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (32685e9) to head (e543aa8).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #452      +/-   ##
==========================================
+ Coverage   93.41%   93.44%   +0.02%     
==========================================
  Files          14       14              
  Lines        2006     2014       +8     
==========================================
+ Hits         1874     1882       +8     
  Misses        132      132              
Files with missing lines Coverage Δ
qiniu/sandbox/client.js 97.09% <100.00%> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found in this review.

Local verification note: npm run check-type could not run because tsc is not executable in this workspace, and the focused mocha command could not run because node_modules/.bin/mocha is absent.

@miclle miclle self-assigned this Jul 6, 2026
@miclle
miclle merged commit 788495f into qiniu:master Jul 6, 2026
9 checks passed
@miclle
miclle deleted the codex/sandbox-injection-conditions branch July 6, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant