Skip to content

Commit 50ea4e3

Browse files
committed
Set User-Agent for tools and godep pacakge
1 parent 15326f3 commit 50ea4e3

File tree

6 files changed

+10
-1
lines changed

6 files changed

+10
-1
lines changed

godep/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import (
1313
depclient "github.com/micromdm/nanodep/client"
1414
)
1515

16-
const mediaType = "application/json;charset=UTF8"
16+
const (
17+
mediaType = "application/json;charset=UTF8"
18+
userAgent = "nanodep-godep/0"
19+
)
1720

1821
// HTTPError encapsulates an HTTP response error from the DEP requests.
1922
// The API returns error information in the request body.
@@ -103,6 +106,7 @@ func (c *Client) do(ctx context.Context, name, method, path string, in interface
103106
if err != nil {
104107
return err
105108
}
109+
req.Header.Set("User-Agent", userAgent)
106110
if body != nil {
107111
req.Header.Set("Content-Type", mediaType)
108112
}

tools/dep-account-detail.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ URL="${BASE_URL}/proxy/${DEP_NAME}${DEP_ENDPOINT}"
88
curl \
99
$CURL_OPTS \
1010
-u depserver:$APIKEY \
11+
-A "nanodep-tools/0" \
1112
"$URL"
1213

tools/dep-define-profile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ curl \
1111
-X POST \
1212
-H 'Content-type: application/json;charset=UTF8' \
1313
-T "$1" \
14+
-A "nanodep-tools/0" \
1415
"$URL"

tools/dep-device-details.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ jq -n --arg device "$1" '.devices = [$device]' \
1212
-X POST \
1313
-H 'Content-type: application/json;charset=UTF8' \
1414
--data-binary @- \
15+
-A "nanodep-tools/0" \
1516
"$URL"

tools/dep-get-profile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ URL="${BASE_URL}/proxy/${DEP_NAME}${DEP_ENDPOINT}?profile_uuid=$1"
88
curl \
99
$CURL_OPTS \
1010
-u "depserver:$APIKEY" \
11+
-A "nanodep-tools/0" \
1112
"$URL"

tools/dep-remove-profile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jq -n --arg device "$1" '.devices = [$device]' \
1313
-X DELETE \
1414
-H 'Content-type: application/json;charset=UTF8' \
1515
--data-binary @- \
16+
-A "nanodep-tools/0" \
1617
"$URL"

0 commit comments

Comments
 (0)