Skip to content

Commit c8dbe8b

Browse files
committed
removed context for testing and troubleshooting
1 parent ad5e188 commit c8dbe8b

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

apiintegrations/jamfpro/jamfpro_api_headers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (j *JamfAPIHandler) GetContentTypeHeader(endpoint string, log logger.Logger
3232

3333
// Special case for package upload endpoint
3434
if strings.HasPrefix(endpoint, "/api/v1/packages") && strings.HasSuffix(endpoint, "/upload") {
35-
j.Logger.Debug("Skipping Content-Type setting for package upload endpoint. Multipart request will set", zap.String("endpoint", endpoint))
35+
j.Logger.Debug("Skipping Content-Type setting for package upload endpoint. Multipart request will handling setting directly with boundary", zap.String("endpoint", endpoint))
3636
return "" // Skip setting Content-Type here
3737
}
3838

httpclient/multipartrequest.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package httpclient
22

33
import (
44
"bytes"
5-
"context"
65
"encoding/base64"
76
"fmt"
87
"io"
@@ -26,8 +25,6 @@ import (
2625
// DoMultiPartRequest creates and executes a multipart/form-data HTTP request for file uploads and form fields.
2726
func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]string, params map[string]string, contentTypes map[string]string, headersMap map[string]http.Header, out interface{}) (*http.Response, error) {
2827
log := c.Logger
29-
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
30-
defer cancel() // Ensure the context is canceled when the function returns
3128

3229
// Ensure the method is supported
3330
if method != http.MethodPost && method != http.MethodPut {
@@ -48,14 +45,6 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
4845
return nil, err
4946
}
5047

51-
// Acquire a concurrency permit to control the number of concurrent requests.
52-
ctx, requestID, err := c.ConcurrencyHandler.AcquireConcurrencyPermit(ctx)
53-
if err != nil {
54-
log.Error("Failed to acquire concurrency permit", zap.Error(err))
55-
return nil, err
56-
}
57-
defer c.ConcurrencyHandler.ReleaseConcurrencyPermit(requestID)
58-
5948
log.Debug("Executing multipart request", zap.String("method", method), zap.String("endpoint", endpoint))
6049

6150
body, contentType, err := createMultipartRequestBody(files, params, contentTypes, headersMap, log)
@@ -86,8 +75,6 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]
8675
headerHandler.SetRequestHeaders(endpoint)
8776
headerHandler.LogHeaders(c.clientConfig.ClientOptions.Logging.HideSensitiveData)
8877

89-
req = req.WithContext(ctx)
90-
9178
startTime := time.Now()
9279
resp, err := c.httpClient.Do(req)
9380
if err != nil {

0 commit comments

Comments
 (0)