Skip to content

Passing custom headers through to http.request() #223

@c-pius

Description

@c-pius

When using HttpEmitter.send() method, how can I pass additional header arguments (e.g. meant for our infrastructure) that are passed through to the http.request() call?

I tried to use

const emitter = new HTTPEmitter({
    url: "https://foo.bar"
})

const event = ...

emitter.send(event, {
  headers: {
    customheader: "...",
    authorization: "Bearer ...."
  }
})

When debugging, it seemed like the passed headers are overwritten by the default headers.

const config = { ...options, ...defaults };

translated to

const config = Object.assign(Object.assign({}, options), defaults);

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions