@@ -74,12 +74,19 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
7474 return nil , fmt .Errorf ("unsupported HTTP method: %s" , method )
7575 }
7676
77- log .Info ("Executing multipart file upload request" , zap .String ("method" , method ), zap .String ("endpoint" , endpoint ))
78-
7977 url := (* c .Integration ).GetFQDN () + endpoint
8078
81- // Create a context with timeout based on the custom timeout duration
82- ctx , cancel := context .WithTimeout (context .Background (), c .config .CustomTimeout )
79+ var ctx context.Context
80+ var cancel context.CancelFunc
81+
82+ if c .config .CustomTimeout > 0 {
83+ ctx , cancel = context .WithTimeout (context .Background (), c .config .CustomTimeout )
84+ log .Info ("Using timeout context for multipart request" , zap .Duration ("timeout" , c .config .CustomTimeout ))
85+ } else {
86+ ctx = context .Background ()
87+ cancel = func () {}
88+ log .Info ("Using background context for multipart request. Caller will handle timeouts" )
89+ }
8390 defer cancel ()
8491
8592 var body io.Reader
@@ -92,7 +99,7 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
9299 if err != nil {
93100 log .Error ("Failed to create streaming multipart request body" , zap .Error (err ))
94101 } else {
95- log .Info ("Successfully created multipart request body" )
102+ log .Info ("Successfully created streaming multipart request body" , zap . String ( "content_type" , contentType ) )
96103 }
97104 return err
98105 }
@@ -111,9 +118,6 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
111118 // Log the request details
112119 log .Info ("Created HTTP Multipart request" , zap .String ("method" , method ), zap .String ("url" , url ), zap .String ("content_type" , contentType ))
113120
114- // Set the Content-Type header
115- req .Header .Set ("Content-Type" , contentType )
116-
117121 (* c .Integration ).PrepRequestParamsAndAuth (req )
118122
119123 req .Header .Set ("Content-Type" , contentType )
0 commit comments