From 33bb04b867ff6c4bf2d4d91eb834fa5a018bef79 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 25 Jan 2023 13:41:57 +0200 Subject: [PATCH] Add newline after printing response body On linux shells the command prompt will be shown on the same line where the uipathcli output ends. Adding a newline after printing the response body displays the prompt on the next line as expected. --- test/execution_test.go | 3 ++- utils/http_logger.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/execution_test.go b/test/execution_test.go index 9fb06f7..906e081 100644 --- a/test/execution_test.go +++ b/test/execution_test.go @@ -48,7 +48,8 @@ paths: expectedStdOut := `{ "hello": "world" -}` +} +` if result.StdOut != expectedStdOut { t.Errorf("Expected response body on stdout %v, got: %v", expectedStdOut, result.StdOut) } diff --git a/utils/http_logger.go b/utils/http_logger.go index 1fbe6cc..133e3dc 100644 --- a/utils/http_logger.go +++ b/utils/http_logger.go @@ -76,6 +76,8 @@ func (l HttpLogger) LogResponse(response *http.Response) error { response.Body = io.NopCloser(bytes.NewBuffer(body)) if len(body) == 0 && response.StatusCode >= 400 { fmt.Fprintf(l.Output, "%s %s\n", response.Proto, response.Status) + } else { + fmt.Fprint(l.Output, "\n") } return err }