-
Notifications
You must be signed in to change notification settings - Fork 998
Refactor options handling for fetch request #6422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -420,7 +420,9 @@ export class FetchInstrumentation extends InstrumentationBase<FetchInstrumentati | |||||
| args[0] instanceof Request ? args[0].url : String(args[0]) | ||||||
| ).href; | ||||||
|
|
||||||
| const options = args[0] instanceof Request ? args[0] : args[1] || {}; | ||||||
| const options = args[0] instanceof Request | ||||||
| ? new Request(args[0], args[1]) | ||||||
| : { url: args[0], ...args[1] }; | ||||||
|
||||||
| : { url: args[0], ...args[1] }; | |
| : (args[1] || {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no tests covering the scenario where both a Request object and a RequestInit object are passed to fetch (e.g.,
fetch(new Request(...), requestInit)). This is the exact issue mentioned in #6421. Tests should be added to verify that the RequestInit options properly override or extend the Request object's properties, as per the Fetch API specification.