Add spacing to comments
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/BBVA/kapow/internal/http"
|
"github.com/BBVA/kapow/internal/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
//GetData will perform the request and write the results on the provided writer
|
// GetData will perform the request and write the results on the provided writer
|
||||||
func GetData(host, id, path string, wr io.Writer) error {
|
func GetData(host, id, path string, wr io.Writer) error {
|
||||||
url := host + "/handlers/" + id + path
|
url := host + "/handlers/" + id + path
|
||||||
return http.Get(url, "", nil, wr)
|
return http.Get(url, "", nil, wr)
|
||||||
|
|||||||
@@ -7,32 +7,32 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Get perform a request using Request with the GET method
|
// Get perform a request using Request with the GET method
|
||||||
func Get(url string, contentType string, r io.Reader, w io.Writer) error {
|
func Get(url string, contentType string, r io.Reader, w io.Writer) error {
|
||||||
return Request("GET", url, contentType, r, w)
|
return Request("GET", url, contentType, r, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Post perform a request using Request with the POST method
|
// Post perform a request using Request with the POST method
|
||||||
func Post(url string, contentType string, r io.Reader, w io.Writer) error {
|
func Post(url string, contentType string, r io.Reader, w io.Writer) error {
|
||||||
return Request("POST", url, contentType, r, w)
|
return Request("POST", url, contentType, r, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Put perform a request using Request with the PUT method
|
// Put perform a request using Request with the PUT method
|
||||||
func Put(url string, contentType string, r io.Reader, w io.Writer) error {
|
func Put(url string, contentType string, r io.Reader, w io.Writer) error {
|
||||||
return Request("PUT", url, contentType, r, w)
|
return Request("PUT", url, contentType, r, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delete perform a request using Request with the DELETE method
|
// Delete perform a request using Request with the DELETE method
|
||||||
func Delete(url string, contentType string, r io.Reader, w io.Writer) error {
|
func Delete(url string, contentType string, r io.Reader, w io.Writer) error {
|
||||||
return Request("DELETE", url, contentType, r, w)
|
return Request("DELETE", url, contentType, r, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
var devnull = ioutil.Discard
|
var devnull = ioutil.Discard
|
||||||
|
|
||||||
//Request will perform the request to the given url and method sending the
|
// Request will perform the request to the given url and method sending the
|
||||||
//content of the given reader as the body and writing all the contents
|
// content of the given reader as the body and writing all the contents
|
||||||
//of the response to the given writer. The reader and writer are
|
// of the response to the given writer. The reader and writer are
|
||||||
//optional.
|
// optional.
|
||||||
func Request(method string, url string, contentType string, r io.Reader, w io.Writer) error {
|
func Request(method string, url string, contentType string, r io.Reader, w io.Writer) error {
|
||||||
req, err := http.NewRequest(method, url, r)
|
req, err := http.NewRequest(method, url, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -65,6 +65,4 @@ func Request(method string, url string, contentType string, r io.Reader, w io.Wr
|
|||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
||||||
// TODO: close the connection, otherwise we'll have a port leak in the server
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user