Skip to content

Commit 31e7a64

Browse files
committed
Fix panic on http error
1 parent 85f72f2 commit 31e7a64

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/http.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ func (h HTTP) fetch(url string) {
4545
resp, err := http.Get(url)
4646
if err != nil {
4747
h.c <- res{err: err}
48+
return
4849
}
4950
defer resp.Body.Close()
5051
b, err := ioutil.ReadAll(resp.Body)
5152
if err != nil {
5253
h.c <- res{err: err}
54+
return
5355
}
5456
jq, err := gojq.NewStringQuery(string(b))
5557
h.c <- res{jq: jq, err: err}

0 commit comments

Comments
 (0)