Skip to content

Commit 3b18bf8

Browse files
committed
fix(instr-undici): fix compile error
1 parent c5c1a77 commit 3b18bf8

File tree

1 file changed

+4
-4
lines changed
  • plugins/node/instrumentation-undici/src

1 file changed

+4
-4
lines changed

plugins/node/instrumentation-undici/src/undici.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta
169169
* Yield an object { key, value } for each header in the request. Skips
170170
* likely-invalid headers. Multi-valued headers are passed through.
171171
*/
172-
private *requestHeaders(
172+
private *parseRequestHeaders(
173173
request: UndiciRequest
174-
): Generator<{ key: string; value: string }, never, never> {
174+
): Generator<{ key: string; value: string | string[] }> {
175175
if (Array.isArray(request.headers)) {
176176
// headers are an array [k1, v2, k2, v2] (undici v6+)
177177
for (let i = 0; i < request.headers.length; i += 2) {
@@ -254,7 +254,7 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta
254254
}
255255

256256
// Get user agent from headers
257-
for (const { key, value } of this.requestHeaders(request)) {
257+
for (const { key, value } of this.parseRequestHeaders(request)) {
258258
if (key.toLowerCase() === 'user-agent') {
259259
// user-agent should only appear once per the spec, but the library doesn't
260260
// prevent passing it multiple times, so we handle that to be safe.
@@ -355,7 +355,7 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta
355355
config.headersToSpanAttributes.requestHeaders.map(n => n.toLowerCase())
356356
);
357357

358-
for (const { key, value } of this.requestHeaders(request)) {
358+
for (const { key, value } of this.parseRequestHeaders(request)) {
359359
const name = key.toLowerCase();
360360
if (headersToAttribs.has(name)) {
361361
spanAttributes[`http.request.header.${name}`] = value

0 commit comments

Comments
 (0)