fix: expose Headers iterable prototype - #11051
proggeramlug wants to merge 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe runtime now resolves WHATWG fetch handles to built-in prototypes and installs ChangesHeaders Prototype Iteration
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change adds the intended Headers prototype and iterator behavior with regression coverage; no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The Full details: Docstring CoverageExplanation Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
|
Landed on Your commits are on Nothing is lost and nothing is needed from you. Thanks. |
Closes #10744.
What changed
Object.getPrototypeOfHeaders.prototype[Symbol.iterator]as the same function asHeaders.prototype.entriesWhy
Axios's fetch adapter passes the response's Web
Headersobject toAxiosHeaders.from. Axios deliberately treats a value as safely iterable only whenSymbol.iteratoris owned somewhere belowObject.prototype.Perry's
Headershandle implementedentries()and direct iteration through native dispatch, butObject.getPrototypeOf(headers)returnednulland the reflected prototype had no own iterator symbol. Axios therefore classified the value as a plain record, calledObject.keys(headers), and copied zero headers.Verification
cargo fmt --all -- --checkscripts/check_file_size.shgit diff --checkperry+ runtime + stdlib build under theperry-devprofileRUST_TEST_THREADS=1 cargo test --profile perry-dev -p perry --test issue_10744_headers_prototype --test issue_any_typed_collection_handle_iterator --test issue_8968_response_headers -- --nocaptureaxios@1.18.0against a local HTTP server: Perry now matches Node for the six response header names and returnsapplication/json/worksfor the two asserted valuesSummary by CodeRabbit
Headersobjects now expose the expected iterable behavior, including access to entries through their iterator. This improves compatibility with code that inspectsHeadersprototypes or converts headers into iterable collections.