mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Addressing comments
This commit is contained in:
@@ -44,13 +44,13 @@ func getTask(ctx context.Context, url string) (*models.Task, error) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req.WithContext(ctx))
|
resp, err := client.Do(req.WithContext(ctx))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
io.Copy(ioutil.Discard, resp.Body)
|
io.Copy(ioutil.Discard, resp.Body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return nil, errors.New(fmt.Sprintf("Unable to get task. Reason: %v", resp.Status))
|
return nil, errors.New(fmt.Sprintf("Unable to get task. Reason: %v", resp.Status))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user