mirror of
https://github.com/fosrl/newt.git
synced 2026-03-04 09:46:44 +00:00
Print the body for debug
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@@ -281,8 +282,9 @@ func (c *Client) getToken() (string, error) {
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
logger.Error("Failed to get token with status code: %d", resp.StatusCode)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
return "", fmt.Errorf("failed to get token with status code: %d", resp.StatusCode)
|
logger.Error("Failed to get token with status code: %d, body: %s", resp.StatusCode, string(body))
|
||||||
|
return "", fmt.Errorf("failed to get token with status code: %d, body: %s", resp.StatusCode, string(body))
|
||||||
}
|
}
|
||||||
|
|
||||||
var tokenResp TokenResponse
|
var tokenResp TokenResponse
|
||||||
|
|||||||
Reference in New Issue
Block a user