Skip to content

Commit

Permalink
feat: copy headers
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Mar 8, 2024
1 parent 1c4f38e commit ba2d68f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration/watermill/gtm/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"strings"

"github.com/ThreeDotsLabs/watermill/message"
Expand Down Expand Up @@ -111,6 +112,10 @@ func (p *Publisher) Publish(topic string, messages ...*message.Message) error {

// p.l.Trace("Publishing message", logFields)

r, _ := httputil.DumpRequestOut(req, true)
fmt.Println("--> Outgoing publish")
fmt.Println(string(r))

resp, err := p.client.Do(req)
if err != nil {
return errors.Wrapf(err, "failed to publish message: %s", msg.UUID)
Expand Down
3 changes: 3 additions & 0 deletions measurementprotocol/v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ func (c *Client) SendRaw(r *http.Request, event *Event) error {
return errors.Wrap(err, "failed to create request")
}

// copy headers
req.Header = r.Header.Clone()

// forward cookies
for _, cookie := range c.cookies {
if value, _ := r.Cookie(cookie); value != nil {
Expand Down

0 comments on commit ba2d68f

Please sign in to comment.