File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package tunnel
33import (
44 "encoding/json"
55 "fmt"
6+ "io"
67 "net/http"
78 "strings"
89 "time"
@@ -44,8 +45,17 @@ func RunQuickTunnel(sc *subcommandContext) error {
4445 }
4546 defer resp .Body .Close ()
4647
48+ // This will read the entire response into memory so we can print it in case of error
49+ rsp_body , err := io .ReadAll (resp .Body )
50+ if err != nil {
51+ return errors .Wrap (err , "failed to read quick-tunnel response" )
52+ }
53+
4754 var data QuickTunnelResponse
48- if err := json .NewDecoder (resp .Body ).Decode (& data ); err != nil {
55+ if err := json .Unmarshal (rsp_body , & data ); err != nil {
56+ rsp_string := string (rsp_body )
57+ fields := map [string ]interface {}{"status_code" : resp .Status }
58+ sc .log .Err (err ).Fields (fields ).Msgf ("Error unmarshaling QuickTunnel response: %s" , rsp_string )
4959 return errors .Wrap (err , "failed to unmarshal quick Tunnel" )
5060 }
5161
You can’t perform that action at this time.
0 commit comments