Commit 963c9ad 1 parent 64bc5ba commit 963c9ad Copy full SHA for 963c9ad
File tree 1 file changed +10
-12
lines changed
1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import (
25
25
"encoding/json"
26
26
"errors"
27
27
"fmt"
28
- "io/ioutil "
28
+ "io"
29
29
"math/big"
30
30
"net/http"
31
31
"os"
@@ -1355,14 +1355,12 @@ func verifyZkProof(input []byte) []byte {
1355
1355
if err != nil {
1356
1356
continue
1357
1357
}
1358
- // The ZKPoK service returns 406 if the proof is incorrect.
1358
+ defer resp .Body .Close ()
1359
+ body , err := io .ReadAll (resp .Body )
1359
1360
if resp .StatusCode == 406 {
1361
+ // The ZKPoK service returns 406 if the proof is incorrect.
1360
1362
return nil
1361
- } else if resp .StatusCode != 200 {
1362
- continue
1363
- }
1364
- body , err := ioutil .ReadAll (resp .Body )
1365
- if err != nil {
1363
+ } else if resp .StatusCode != 200 || err != nil {
1366
1364
continue
1367
1365
}
1368
1366
return body
@@ -1493,6 +1491,8 @@ func putRequire(ct *tfheCiphertext) bool {
1493
1491
if err != nil {
1494
1492
continue
1495
1493
}
1494
+ defer resp .Body .Close ()
1495
+ io .ReadAll (resp .Body )
1496
1496
if resp .StatusCode != 200 {
1497
1497
continue
1498
1498
}
@@ -1516,11 +1516,9 @@ func getRequire(ct *tfheCiphertext) bool {
1516
1516
if err != nil {
1517
1517
continue
1518
1518
}
1519
- if resp .StatusCode != 200 {
1520
- continue
1521
- }
1522
- body , err := ioutil .ReadAll (resp .Body )
1523
- if err != nil {
1519
+ defer resp .Body .Close ()
1520
+ body , err := io .ReadAll (resp .Body )
1521
+ if resp .StatusCode != 200 || err != nil {
1524
1522
continue
1525
1523
}
1526
1524
msg := requireMessage {}
You can’t perform that action at this time.
0 commit comments