Commit Graph

8 Commits

Author SHA1 Message Date
pancho horrillo
2d5743af84 Add blank line between legal header and package declaration
Otherwise, the legal header is rendered as package documentation.
2019-11-13 18:18:44 +01:00
Héctor Hurtado
723e4787b3 Added legal header to all Go source files 2019-10-23 13:35:01 +02:00
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
Roberto Abdelkader Martínez Pérez
4224984e1b Add spacing to comments 2019-10-04 14:18:42 +02:00
Roberto Abdelkader Martínez Pérez
9f7fc8ce62 Allow user specify Content-Type header 2019-10-03 20:55:11 +02:00
pancho horrillo
306889c958 Add TODO on closing the connection of the http.Client
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 16:52:55 +02:00
Roberto Abdelkader Martínez Pérez
b1c2db057c Shorthand functions request with common HTTP methods 2019-10-03 15:06:26 +02:00
Roberto Abdelkader Martínez Pérez
681ee3cba8 http becomes an internal package 2019-10-03 14:12:14 +02:00