Skip to content

Commit bf42a64

Browse files
authored
Merge branch 'main' into dev-jl-testing
2 parents 300abc4 + 0ab7364 commit bf42a64

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

jamf/jamfprointegration/marshall.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
// - Logs the marshaled request body for POST, PUT, and PATCH methods using the integrated logger.
3535
// - Logs an error if marshaling fails and returns the error.
3636
// - Returns an error if the format is invalid.
37-
func (j *Integration) marshalRequest(body interface{}, method string, endpoint string) ([]byte, error) {
37+
func (j *Integration) marshalRequest(body interface{}, _ string, endpoint string) ([]byte, error) {
3838
var (
3939
data []byte
4040
err error
@@ -54,9 +54,9 @@ func (j *Integration) marshalRequest(body interface{}, method string, endpoint s
5454
return nil, err
5555
}
5656

57-
if method == "POST" || method == "PUT" {
58-
j.Sugar.Debug("XML Request Body", zap.String("Body", string(data)))
59-
}
57+
// if method == "POST" || method == "PUT" {
58+
// j.Sugar.Debug("XML Request Body", zap.String("Body", string(data)))
59+
// }
6060

6161
return data, nil
6262

jamf/jamfprointegration/preprequest.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ import (
2222
// - Checks and refreshes the token if necessary using the Integration's checkRefreshToken method.
2323
// - Adds an "Authorization" header with a Bearer token obtained from the Integration's auth.getTokenString method.
2424
func (j *Integration) prepRequest(req *http.Request) error {
25+
26+
j.Sugar.Debugw("LOG-CONTENT-TYPE", "METHOD", req.Method, "URL", req.URL.String())
27+
if req.Method != "GET" && req.Method != "DELETE" {
28+
req.Header.Add("Content-Type", j.getContentTypeHeader(req.URL.String()))
29+
}
30+
2531
req.Header.Add("Accept", j.getAcceptHeader())
26-
req.Header.Add("Content-Type", j.getContentTypeHeader(req.URL.String()))
2732
req.Header.Add("User-Agent", j.getUserAgentHeader())
2833

2934
j.Sugar.Debug("request headers added, refreshing token")
@@ -38,7 +43,5 @@ func (j *Integration) prepRequest(req *http.Request) error {
3843

3944
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", j.auth.getTokenString()))
4045

41-
j.Sugar.Debug("header added")
42-
4346
return nil
4447
}

0 commit comments

Comments
 (0)