Skip to content

Commit

Permalink
Fix usestdlibvars errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Sep 14, 2023
1 parent 8d9e124 commit 53c6de8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions windows-agent/internal/contracts/contractclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Client) GetServerAccessToken(ctx context.Context) (token string, err er
}

defer res.Body.Close()
if res.StatusCode != 200 {
if res.StatusCode != http.StatusOK {
body, err := io.ReadAll(res.Body)
if err != nil {
return "", fmt.Errorf("server replied with an error: Code %d, %v", res.StatusCode, err)
Expand Down Expand Up @@ -109,17 +109,17 @@ func (c *Client) GetProToken(ctx context.Context, userJWT string) (token string,

defer res.Body.Close()
switch res.StatusCode { // add other error codes as CS team documents them.
case 401:
case http.StatusUnauthorized:
return "", fmt.Errorf("bad user ID key: %v", userJWT)
case 500:
case http.StatusInternalServerError:
return "", errors.New("couldn't validate the user entitlement against MS Store")
default:
body, err := io.ReadAll(res.Body)
if err != nil {
return "", fmt.Errorf("unknown error from the contracts server: Code %d, %v", res.StatusCode, err)
}
return "", fmt.Errorf("unknown error from the contracts server: Code %d, %s", res.StatusCode, body)
case 200:
case http.StatusOK:
}

var data map[string]string
Expand Down

0 comments on commit 53c6de8

Please sign in to comment.