Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions httpclient/multipartrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,26 @@ func (c *Client) DoImageMultiPartUpload(method, endpoint string, fileName string
return nil, fmt.Errorf("failed to create request: %v", err)
}

// Set headers with clean boundary
// Clear existing headers and set only what we need
req.Header = http.Header{}
contentTypeHeader := fmt.Sprintf("multipart/form-data; boundary=---%s", cleanBoundary)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", contentTypeHeader)
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", contentTypeHeader)

c.Sugar.Debugw("Request headers before auth",
zap.Any("headers", req.Header),
zap.String("contentType", contentTypeHeader))

preservedAccept := req.Header.Get("Accept")
preservedContentType := req.Header.Get("Content-Type")

(*c.Integration).PrepRequestParamsAndAuth(req)

c.Sugar.Debugw("Request headers after auth",
// Restore our specific headers
req.Header.Set("Accept", preservedAccept)
req.Header.Set("Content-Type", preservedContentType)

c.Sugar.Debugw("Request headers after auth and restoration",
zap.Any("headers", req.Header))

c.Sugar.Infow("Sending custom multipart request",
Expand Down Expand Up @@ -520,7 +528,6 @@ func (c *Client) DoImageMultiPartUpload(method, endpoint string, fileName string
zap.Int("status_code", resp.StatusCode),
zap.Duration("duration", duration))

// Log response headers
c.Sugar.Debugw("Response headers",
zap.Any("headers", resp.Header))

Expand Down
Loading