senecajs / seneca-transport

Seneca micro-services message transport over TCP and HTTP.
MIT License
63 stars 45 forks source link

Add the ability to add headers to web client requests #81

Closed baldmountain closed 8 years ago

baldmountain commented 8 years ago

Add an option named headers that users can use to add headers to client requests the web transport makes. You'd use this by adding the object:

{
  web: {
    headers: {
      'client-id': 'test-client'
    }
  }
}

to the use statement for the transport. This adds the header 'client-id' with the value 'test-client' to requests that the web client makes to other seneca services.

Closes #71

baldmountain commented 8 years ago

This seems like an odd pull request so I thought I'd add some justification. We are using PacketBeat to track issues with communications between services. Being able to add a 'client-id' to the header allows us to track information about what services are making http requests (and what their status is) without having to unpack the message.

For more information on PacketBeat see: https://www.elastic.co/products/beats/packetbeat

thanks,