-
Notifications
You must be signed in to change notification settings - Fork 998
Open
Description
Issue
In experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts at line 423,
the current logic discards RequestInit options when a Request object is passed as the
first argument to fetch().
Current Code
const options = args[0] instanceof Request ? args[0] : args[1] || {};When fetch is called as fetch(request, requestInit), the requestInit (args[1]) is completely ignored, which violates the Fetch API specification.
Expected Behavior
According to the Fetch API spec, when a Request object is passed along with a RequestInit, the init options should override or extend the request's properties.
Proposed Fix
const options = args[0] instanceof Request
? new Request(args[0], args[1])
: { url: args[0], ...args[1] };This ensures proper merging of request initialization options.
Affected Code
opentelemetry-js/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts
Line 423 in 7d866ea
| const options = args[0] instanceof Request ? args[0] : args[1] || {}; |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels