@@ -480,18 +480,26 @@ func (c *Client) DoImageMultiPartUpload(method, endpoint string, fileName string
480480 return nil , fmt .Errorf ("failed to create request: %v" , err )
481481 }
482482
483- // Set headers with clean boundary
483+ // Clear existing headers and set only what we need
484+ req .Header = http.Header {}
484485 contentTypeHeader := fmt .Sprintf ("multipart/form-data; boundary=---%s" , cleanBoundary )
485- req .Header .Add ("Accept" , "application/json" )
486- req .Header .Add ("Content-Type" , contentTypeHeader )
486+ req .Header .Set ("Accept" , "application/json" )
487+ req .Header .Set ("Content-Type" , contentTypeHeader )
487488
488489 c .Sugar .Debugw ("Request headers before auth" ,
489490 zap .Any ("headers" , req .Header ),
490491 zap .String ("contentType" , contentTypeHeader ))
491492
493+ preservedAccept := req .Header .Get ("Accept" )
494+ preservedContentType := req .Header .Get ("Content-Type" )
495+
492496 (* c .Integration ).PrepRequestParamsAndAuth (req )
493497
494- c .Sugar .Debugw ("Request headers after auth" ,
498+ // Restore our specific headers
499+ req .Header .Set ("Accept" , preservedAccept )
500+ req .Header .Set ("Content-Type" , preservedContentType )
501+
502+ c .Sugar .Debugw ("Request headers after auth and restoration" ,
495503 zap .Any ("headers" , req .Header ))
496504
497505 c .Sugar .Infow ("Sending custom multipart request" ,
@@ -520,7 +528,6 @@ func (c *Client) DoImageMultiPartUpload(method, endpoint string, fileName string
520528 zap .Int ("status_code" , resp .StatusCode ),
521529 zap .Duration ("duration" , duration ))
522530
523- // Log response headers
524531 c .Sugar .Debugw ("Response headers" ,
525532 zap .Any ("headers" , resp .Header ))
526533
0 commit comments