This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Commit 5bc0f11
committed
Handle response errors more properly
Value returned by http client Do function is nil or already closed if
there is any error. See
https://golang.org/src/net/http/client.go?s=16518:16570#L480
Therefore in order to avoid memory leaks in a potential ioutil.ReadAll
error and to be Go idioms compliant, the response body is deferred to be
closed immediately after checking there is no error with the Do function.
CAT: #fix
REF: #8
THX: @Zambiorix1 parent 79e54fc commit 5bc0f11
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
153 | | - | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
0 commit comments