@@ -2,6 +2,7 @@ package httpclient
22
33import (
44 "bytes"
5+ "context"
56 "encoding/base64"
67 "fmt"
78 "io"
@@ -58,8 +59,12 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
5859 // Construct the full URL for the API endpoint.
5960 url := c .APIHandler .ConstructAPIResourceEndpoint (endpoint , log )
6061
61- // Create the HTTP request
62- req , err := http .NewRequest (method , url , body )
62+ // Create a context with timeout
63+ ctx , cancel := context .WithTimeout (context .Background (), c .clientConfig .ClientOptions .Timeout .CustomTimeout .Duration ())
64+ defer cancel ()
65+
66+ // Create the HTTP request with context
67+ req , err := http .NewRequestWithContext (ctx , method , url , body )
6368 if err != nil {
6469 log .Error ("Failed to create HTTP request" , zap .Error (err ))
6570 return nil , err
@@ -286,8 +291,6 @@ func logMultiPartRequestBody(body *bytes.Buffer, log logger.Logger) {
286291 encoding := "none"
287292 if strings .Contains (headers , "base64" ) || strings .Contains (bodyContent , "base64," ) {
288293 encoding = "base64"
289- } else if strings .Contains (headers , "quoted-printable" ) {
290- encoding = "quoted-printable"
291294 }
292295
293296 // Log headers and indicate content is omitted
0 commit comments