diff --git a/internal/commands/request/request_internal.go b/internal/commands/request/request_internal.go index 465a441..91a52ef 100644 --- a/internal/commands/request/request_internal.go +++ b/internal/commands/request/request_internal.go @@ -98,19 +98,19 @@ func runInternalPingOneRequest(uri string) (err error) { if res.StatusCode < 200 || res.StatusCode >= 300 { output.Print(output.Opts{ - Message: "Custom request failed.", + Message: "Custom request", Result: output.ENUM_RESULT_FAILURE, Fields: map[string]any{ - "response": string(body), + "response": json.RawMessage(body), "status": res.StatusCode, }, }) } else { output.Print(output.Opts{ - Message: "Custom request successful.", + Message: "Custom request", Result: output.ENUM_RESULT_SUCCESS, Fields: map[string]any{ - "response": string(body), + "response": json.RawMessage(body), "status": res.StatusCode, }, }) diff --git a/internal/output/output.go b/internal/output/output.go index 080e112..a8a5c82 100644 --- a/internal/output/output.go +++ b/internal/output/output.go @@ -107,8 +107,15 @@ func printText(opts Opts) { if opts.Fields != nil { fmt.Println(cyan("Additional Information:")) for k, v := range opts.Fields { - fmt.Println(cyan("%s: %v", k, v)) - l.Info().Msgf("%s: %v", k, v) + switch typedValue := v.(type) { + // If the value is a json.RawMessage, print it as a string + case json.RawMessage: + fmt.Println(cyan("%s: %s", k, typedValue)) + l.Info().Msgf("%s: %s", k, typedValue) + default: + fmt.Println(cyan("%s: %v", k, v)) + l.Info().Msgf("%s: %v", k, v) + } } }