feat: copy headers

This commit is contained in:
Kevin Franklin Kim 2024-03-08 14:51:45 +01:00
parent 1c4f38e552
commit ba2d68fd99
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"strings"
"github.com/ThreeDotsLabs/watermill/message"
@ -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)

View File

@ -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 {