rudder-server
rudder-server copied to clipboard
Support writeKey in event body
Segment's documentation recommends setting an Authorization header
https://github.com/rudderlabs/rudder-server/blob/b834143704838cfff7dd01d19b13cbab3b8af2f4/gateway/gateway.go#L147
However, there is at least one other way to supply a write key that is supported by Segment's API.
-
Supplying a write key in the
writeKey
property of the event body will register as a valid event of the specified type. The writeKey in the event body will override the write key in the Authorization header if present. -
Also... Each item in a Batch may contain a different write key from its parent. iirc, Segment will use the batch write key by default and overrides with event specific write key for each event if present.
This API has been designed for maximum interoperability; best to make all possible accommodations.
We never know who might have rolled their own client relying on some quirk like this (they exist).