Skip to content

Commit 7f31774

Browse files
committed
close body when fetching abi
1 parent f520cfc commit 7f31774

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/common/abi.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func GetABIForContract(chainId string, contract string) (*abi.ABI, error) {
3838
if err != nil {
3939
return nil, fmt.Errorf("failed to get contract abi: %v", err)
4040
}
41+
defer resp.Body.Close()
42+
43+
if resp.StatusCode != http.StatusOK {
44+
return nil, fmt.Errorf("failed to get contract abi: unexpected status code %d", resp.StatusCode)
45+
}
4146

4247
abi, err := abi.JSON(resp.Body)
4348
if err != nil {

0 commit comments

Comments
 (0)