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"
@@ -47,8 +48,17 @@ func RunQuickTunnel(sc *subcommandContext) error {
4748 }
4849 defer resp .Body .Close ()
4950
51+ // This will read the entire response into memory so we can print it in case of error
52+ rsp_body , err := io .ReadAll (resp .Body )
53+ if err != nil {
54+ return errors .Wrap (err , "failed to read quick-tunnel response" )
55+ }
56+
5057 var data QuickTunnelResponse
51- if err := json .NewDecoder (resp .Body ).Decode (& data ); err != nil {
58+ if err := json .Unmarshal (rsp_body , & data ); err != nil {
59+ rsp_string := string (rsp_body )
60+ fields := map [string ]interface {}{"status_code" : resp .Status }
61+ sc .log .Err (err ).Fields (fields ).Msgf ("Error unmarshaling QuickTunnel response: %s" , rsp_string )
5262 return errors .Wrap (err , "failed to unmarshal quick Tunnel" )
5363 }
5464
You can’t perform that action at this time.
0 commit comments