diff --git a/api_testsuite.go b/api_testsuite.go index fc4b5f3c..b05bfbe9 100644 --- a/api_testsuite.go +++ b/api_testsuite.go @@ -3,7 +3,7 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -442,7 +442,7 @@ func (ats *Suite) loadManifest() ([]byte, error) { } defer manifestFile.Close() - manifestTmpl, err := ioutil.ReadAll(manifestFile) + manifestTmpl, err := io.ReadAll(manifestFile) if err != nil { return res, fmt.Errorf("error loading manifest (%s): %s", ats.manifestPath, err) } diff --git a/http_server.go b/http_server.go index 02250147..f246a3ee 100644 --- a/http_server.go +++ b/http_server.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "io" - "io/ioutil" "net/http" "net/url" "path/filepath" @@ -155,7 +154,7 @@ func bounceJSON(w http.ResponseWriter, r *http.Request) { bodyJSON, errorBody any ) - bodyBytes, err = ioutil.ReadAll(r.Body) + bodyBytes, err = io.ReadAll(r.Body) if utf8.Valid(bodyBytes) { if len(bodyBytes) > 0 { diff --git a/internal/httpproxy/store.go b/internal/httpproxy/store.go index 99ead104..af50c676 100644 --- a/internal/httpproxy/store.go +++ b/internal/httpproxy/store.go @@ -3,7 +3,7 @@ package httpproxy import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -63,7 +63,7 @@ func (st *store) write(w http.ResponseWriter, r *http.Request) { offset := len(st.Data) if r.Body != nil { - reqData.Body, err = ioutil.ReadAll(r.Body) + reqData.Body, err = io.ReadAll(r.Body) if err != nil { handlerutil.RespondWithErr(w, http.StatusInternalServerError, errors.Errorf("Could not read request body: %s", err)) return diff --git a/pkg/lib/api/request.go b/pkg/lib/api/request.go index a3a4619c..2e1bd56c 100755 --- a/pkg/lib/api/request.go +++ b/pkg/lib/api/request.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/httputil" "net/url" @@ -293,7 +292,7 @@ func (request Request) ToString(curl bool) (res string) { // return r.Replace(curl.String()) } - _, _ = io.Copy(ioutil.Discard, httpRequest.Body) + _, _ = io.Copy(io.Discard, httpRequest.Body) _ = httpRequest.Body.Close() curl, _ := http2curl.GetCurlCommand(httpRequest) diff --git a/pkg/lib/api/response.go b/pkg/lib/api/response.go index 1d095c26..92f75504 100755 --- a/pkg/lib/api/response.go +++ b/pkg/lib/api/response.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "strings" "time" @@ -102,7 +101,7 @@ func NewResponse(statusCode int, } if body != nil { start := time.Now() - res.Body, err = ioutil.ReadAll(body) + res.Body, err = io.ReadAll(body) if err != nil { return res, err } diff --git a/pkg/lib/report/report.go b/pkg/lib/report/report.go index a8f072a9..c9ee5af9 100755 --- a/pkg/lib/report/report.go +++ b/pkg/lib/report/report.go @@ -2,7 +2,7 @@ package report import ( "fmt" - "io/ioutil" + "os" "sync" "time" @@ -196,7 +196,7 @@ func (r *Report) WriteToFile(reportFile, reportFormat string) error { parsingFunction = ParseJSONResult } - err := ioutil.WriteFile(reportFile, r.GetTestResult(parsingFunction), 0644) + err := os.WriteFile(reportFile, r.GetTestResult(parsingFunction), 0644) if err != nil { logrus.Errorf("Could not save report into file: %s", err) return err diff --git a/pkg/lib/template/template_loader.go b/pkg/lib/template/template_loader.go index 4074e35f..160a07a6 100644 --- a/pkg/lib/template/template_loader.go +++ b/pkg/lib/template/template_loader.go @@ -128,7 +128,7 @@ func (loader *Loader) Render( // if err != nil { // return nil, err // } - // fileBytes, err := ioutil.ReadAll(file) + // fileBytes, err := io.ReadAll(file) // if err != nil { // return nil, err // }