p2p: use errors.Is for error comparison (#24882)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Håvard Anda Estensen
2022-06-07 17:27:21 +02:00
committed by GitHub
co-authored by Felix Lange
parent 41e75480df
commit 138f0d7494
9 changed files with 24 additions and 13 deletions
+2 -1
View File
@@ -21,6 +21,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"html"
"io"
@@ -559,7 +560,7 @@ func (s *Server) CreateNode(w http.ResponseWriter, req *http.Request) {
config := &adapters.NodeConfig{}
err := json.NewDecoder(req.Body).Decode(config)
if err != nil && err != io.EOF {
if err != nil && !errors.Is(err, io.EOF) {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}