Skip to content

Commit

Permalink
Comms: add http client common utilities and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
somolinosm authored and adrianpozueco committed Jul 7, 2021
1 parent 76d9104 commit d25d356
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions comms/httpClient.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package comms

import (
"io"
"net/http"
)

type HttpClient struct {
Client *http.Client
}

func NewHttpClient(client *http.Client) *HttpClient {
return &HttpClient{Client: client}
}

func (httpClient *HttpClient) GetRequest(method string, url string, body io.Reader) (*http.Request, error) {
return http.NewRequest(method, url, body)
}

func (httpClient *HttpClient) DoRequest(r *http.Request) (*http.Response, error) {
return httpClient.Client.Do(r)
}

0 comments on commit d25d356

Please sign in to comment.