replaced deprecated 'io/ioutil' with 'io'
Some checks failed
Run Integration Tests / test (push) Failing after 39s
Some checks failed
Run Integration Tests / test (push) Failing after 39s
This commit is contained in:
parent
851b93bed5
commit
24c7a09479
3 changed files with 26 additions and 11 deletions
7
node.go
7
node.go
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
@ -65,7 +65,10 @@ func sendMessage(serverAddr string, msg Message) error {
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read response body: %v", err)
|
||||
}
|
||||
return fmt.Errorf("server error: %s", body)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue