55 "context"
66 "fmt"
77 "io"
8- "io/ioutil"
98 "net"
109 "net/http"
1110 "net/http/httptrace"
@@ -244,7 +243,7 @@ func (b *BaseGun) Shoot(ammo Ammo) {
244243 sample .SetProtoCode (res .StatusCode )
245244 defer res .Body .Close ()
246245 // TODO: measure body read time
247- _ , err = io .Copy (ioutil .Discard , res .Body ) // Buffers are pooled for ioutil .Discard
246+ _ , err = io .Copy (io .Discard , res .Body ) // Buffers are pooled for io .Discard
248247 if err != nil {
249248 b .Log .Warn ("Body read fail" , zap .Error (err ))
250249 return
@@ -260,7 +259,7 @@ func (b *BaseGun) Close() error {
260259
261260func (b * BaseGun ) verboseLogging (res * http.Response ) {
262261 if res .Request .Body != nil {
263- reqBody , err := ioutil .ReadAll (res .Request .Body )
262+ reqBody , err := io .ReadAll (res .Request .Body )
264263 if err != nil {
265264 b .Log .Debug ("Body read failed for verbose logging of Request" )
266265 } else {
@@ -275,7 +274,7 @@ func (b *BaseGun) verboseLogging(res *http.Response) {
275274 )
276275
277276 if res .Body != nil {
278- respBody , err := ioutil .ReadAll (res .Body )
277+ respBody , err := io .ReadAll (res .Body )
279278 if err != nil {
280279 b .Log .Debug ("Body read failed for verbose logging of Response" )
281280 } else {
@@ -328,8 +327,8 @@ func autotag(depth int, URL *url.URL) string {
328327
329328func GetBody (req * http.Request ) []byte {
330329 if req .Body != nil && req .Body != http .NoBody {
331- bodyBytes , _ := ioutil .ReadAll (req .Body )
332- req .Body = ioutil .NopCloser (bytes .NewBuffer (bodyBytes ))
330+ bodyBytes , _ := io .ReadAll (req .Body )
331+ req .Body = io .NopCloser (bytes .NewBuffer (bodyBytes ))
333332 return bodyBytes
334333 }
335334
0 commit comments