diff --git a/internal/util/http.go b/internal/util/http.go new file mode 100644 index 00000000..b0b1440b --- /dev/null +++ b/internal/util/http.go @@ -0,0 +1,18 @@ +package util + +import ( + "bytes" + "io" + "net/http" +) + +func ReadAndCopyBackResponseBody(resp *http.Response) string { + respBody, _ := io.ReadAll(resp.Body) + respBodyString := string(respBody) + + resp.Body.Close() + + resp.Body = io.NopCloser(bytes.NewBuffer(respBody)) + + return respBodyString +}