From b027ac0fc8fe208e841dc5abf22378f3e2592d3f Mon Sep 17 00:00:00 2001 From: Pedro Lopes Date: Wed, 4 May 2022 12:05:15 +0100 Subject: [PATCH] change results command to not print body --- internal/wrappers/client.go | 16 +++++++++++++++- internal/wrappers/results-http.go | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/client.go b/internal/wrappers/client.go index d4d236b63..e15b0d613 100644 --- a/internal/wrappers/client.go +++ b/internal/wrappers/client.go @@ -232,9 +232,23 @@ func GetAuthURL(path string) string { return authURL } +func SendPrivateHTTPRequestWithQueryParams( + method, path string, params map[string]string, + body io.Reader, timeout uint, +) (*http.Response, error) { + return HTTPRequestWithQueryParams(method, path, params, body, timeout, false) +} + func SendHTTPRequestWithQueryParams( method, path string, params map[string]string, body io.Reader, timeout uint, +) (*http.Response, error) { + return HTTPRequestWithQueryParams(method, path, params, body, timeout, true) +} + +func HTTPRequestWithQueryParams( + method, path string, params map[string]string, + body io.Reader, timeout uint, printBody bool, ) (*http.Response, error) { u := GetURL(path) req, err := http.NewRequest(method, u, body) @@ -253,7 +267,7 @@ func SendHTTPRequestWithQueryParams( return nil, err } var resp *http.Response - resp, err = doRequest(client, req) + resp, err = request(client, req, printBody) if err != nil { return resp, errors.Errorf("%s %s \n", checkmarxURLError, req.URL.RequestURI()) } diff --git a/internal/wrappers/results-http.go b/internal/wrappers/results-http.go index 62f7d435a..097f2bf38 100644 --- a/internal/wrappers/results-http.go +++ b/internal/wrappers/results-http.go @@ -32,7 +32,7 @@ func (r *ResultsHTTPWrapper) GetAllResultsByScanID(params map[string]string) ( clientTimeout := viper.GetUint(commonParams.ClientTimeoutKey) // AST has a limit of 10000 results, this makes it get all of them params["limit"] = "10000" - resp, err := SendHTTPRequestWithQueryParams(http.MethodGet, r.path, params, nil, clientTimeout) + resp, err := SendPrivateHTTPRequestWithQueryParams(http.MethodGet, r.path, params, nil, clientTimeout) if err != nil { return nil, nil, err }