Skip to content

Commit

Permalink
remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Wito Chandra committed Nov 8, 2020
1 parent ebc588c commit 8d43997
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions httpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ func (c *Client) AddPlugin(p heimdall.Plugin) {

// Get makes a HTTP GET request to provided URL
func (c *Client) Get(url string, headers http.Header) (*http.Response, error) {
var response *http.Response
request, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return response, errors.Wrap(err, "GET - request creation failed")
return nil, errors.Wrap(err, "GET - request creation failed")
}

request.Header = headers
Expand All @@ -70,10 +69,9 @@ func (c *Client) Get(url string, headers http.Header) (*http.Response, error) {

// Post makes a HTTP POST request to provided URL and requestBody
func (c *Client) Post(url string, body io.Reader, headers http.Header) (*http.Response, error) {
var response *http.Response
request, err := http.NewRequest(http.MethodPost, url, body)
if err != nil {
return response, errors.Wrap(err, "POST - request creation failed")
return nil, errors.Wrap(err, "POST - request creation failed")
}

request.Header = headers
Expand All @@ -83,10 +81,9 @@ func (c *Client) Post(url string, body io.Reader, headers http.Header) (*http.Re

// Put makes a HTTP PUT request to provided URL and requestBody
func (c *Client) Put(url string, body io.Reader, headers http.Header) (*http.Response, error) {
var response *http.Response
request, err := http.NewRequest(http.MethodPut, url, body)
if err != nil {
return response, errors.Wrap(err, "PUT - request creation failed")
return nil, errors.Wrap(err, "PUT - request creation failed")
}

request.Header = headers
Expand All @@ -96,10 +93,9 @@ func (c *Client) Put(url string, body io.Reader, headers http.Header) (*http.Res

// Patch makes a HTTP PATCH request to provided URL and requestBody
func (c *Client) Patch(url string, body io.Reader, headers http.Header) (*http.Response, error) {
var response *http.Response
request, err := http.NewRequest(http.MethodPatch, url, body)
if err != nil {
return response, errors.Wrap(err, "PATCH - request creation failed")
return nil, errors.Wrap(err, "PATCH - request creation failed")
}

request.Header = headers
Expand All @@ -109,10 +105,9 @@ func (c *Client) Patch(url string, body io.Reader, headers http.Header) (*http.R

// Delete makes a HTTP DELETE request with provided URL
func (c *Client) Delete(url string, headers http.Header) (*http.Response, error) {
var response *http.Response
request, err := http.NewRequest(http.MethodDelete, url, nil)
if err != nil {
return response, errors.Wrap(err, "DELETE - request creation failed")
return nil, errors.Wrap(err, "DELETE - request creation failed")
}

request.Header = headers
Expand All @@ -122,11 +117,9 @@ func (c *Client) Delete(url string, headers http.Header) (*http.Response, error)

// Head makes a HTTP HEAD request with provided URL
func (c *Client) Head(url string, headers http.Header) (*http.Response, error) {
var response *http.Response

request, err := http.NewRequest(http.MethodHead, url, nil)
if err != nil {
return response, errors.Wrap(err, "HEAD - request creation failed")
return nil, errors.Wrap(err, "HEAD - request creation failed")
}

request.Header = headers
Expand Down

0 comments on commit 8d43997

Please sign in to comment.