Files
kapow/internal
pancho horrillo 0cab49f082 Simplify handling of http.Client response
As per the doc¹:

  If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close.
  ...
  On error, any Response can be ignored. A non-nil Response with a non-nil error
  only occurs when CheckRedirect fails, and even then the returned Response.Body
  is already closed.

It is thus safe to defer res.Body.Close() as soon as err has been determined to
be nil.

Also, I've dispensed with the separate variable client, since it is not used
later.

¹: https://godoc.org/net/http#Client.Do
2019-10-08 05:42:33 +02:00
..
2019-10-07 08:53:48 +02:00