Skip to content

addHeader removed in Undici request #3043

@bizob2828

Description

@bizob2828

Bug Description

Looks like addHeader was removed in https://github.com/nodejs/undici/pull/3024/files. The New Relic Node.js agent relies on this to propagate headers in our instrumentation.

Reproducible By

const requestHooks = diagnosticsChannel.channel('undici:request:create')
requestHook.subscribe(function requestCreate({ request }) {
  request.addHeader('test-header', 'value')
})

Expected Behavior

Adds test-header with value of value

Logs & Screenshots

TypeError: request.addHeader is not a function
    at addDTHeaders (undici.js:104:13)
    at requestCreateHook (undici.js:162:5)
    at Channel.publish (node:diagnostics_channel:142:9)
    at new Request (request.js:192:23)
    at Client.[dispatch] (client.js:304:21)
    at Intercept (redirect-interceptor.js:11:16)
    at Client.[Intercepted Dispatch] (dispatcher-base.js:158:12)
    at Client.dispatch (dispatcher-base.js:179:40)
    at Pool.[dispatch] (pool-base.js:143:28)

Environment

Any, undici 6.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions