diff --git a/api.go b/api.go index d639749f..43f97ed0 100644 --- a/api.go +++ b/api.go @@ -477,7 +477,7 @@ func (server *ApiServer) Version(response http.ResponseWriter, request *http.Req log := zerolog.Ctx(request.Context()) response.Header().Set("Content-Type", "application/json;charset=utf-8") - version := fmt.Sprintf(`{"version": "%s"}\n`, Version) + version := fmt.Sprintf("{\"version\": \"%s\"}\n", Version) _, err := response.Write([]byte(version)) if err != nil { log.Warn().Err(err).Msg("Version: Failed to write response to client") diff --git a/api_test.go b/api_test.go index 322cfe07..61e99971 100644 --- a/api_test.go +++ b/api_test.go @@ -1103,7 +1103,7 @@ func TestVersionEndpointReturnsVersion(t *testing.T) { t.Fatal("Unable to read body from response") } - if string(body) != `{"version": "git"}\n` { + if string(body) != "{\"version\": \"git\"}\n" { t.Fatal("Expected to return Version from /version, got:", string(body)) } })