Skip to content

Commit 6e0ad2a

Browse files
committed
fix: body defer
1 parent 09e1bd5 commit 6e0ad2a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/p2p/sensor/rpc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,12 @@ func handleRPC(conns *p2p.Conns, networkID uint64) {
5151
return
5252
}
5353

54-
defer r.Body.Close()
55-
5654
body, err := io.ReadAll(r.Body)
5755
if err != nil {
5856
writeError(w, -32700, "Parse error", nil)
5957
return
6058
}
59+
defer r.Body.Close()
6160

6261
// Check if this is a batch request (starts with '[') or single request
6362
trimmed := strings.TrimSpace(string(body))

0 commit comments

Comments
 (0)