mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Replace ioutil with io and os (#10541)
* Replace ioutil with io and os * Fix build errors
This commit is contained in:
committed by
GitHub
parent
982de94428
commit
d2f4a8cc7c
@@ -7,7 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -64,13 +64,13 @@ func captureRequest(f *os.File, m map[string]interface{}) error {
|
||||
}
|
||||
|
||||
func parseRequest(req *http.Request, unmarshalStruct interface{}) error {
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
body, err := io.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = req.Body.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
req.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(body))
|
||||
return json.Unmarshal(body, unmarshalStruct)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user