Skip to content

Commit

Permalink
Possible to externalize problems if not 200 status code from API
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacguerreir committed Oct 14, 2021
1 parent 274986a commit 086fe6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions idtapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package idtapi
import (
"bytes"
"encoding/json"
"io"
"log"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -89,6 +91,13 @@ func GetToken(username string, password string, clientId string, clientSecret st
}

return auth
} else {
b, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}

log.Fatalln(string(b))
}

return auth
Expand Down

0 comments on commit 086fe6e

Please sign in to comment.