diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-20 16:22:07 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-20 16:22:07 +0200 |
| commit | b73e1489b06fd4546da6ba32697331584db02e71 (patch) | |
| tree | 3893b79958b551d2552efb6d20e729d916346ec6 /src/http.go | |
| parent | 63dfe633c7e62f570d44af6e0ea17967155cb5db (diff) | |
Refactor: Eliminate most uses of pointers in structs
Diffstat (limited to 'src/http.go')
| -rw-r--r-- | src/http.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/http.go b/src/http.go index b247dbb..bbc866b 100644 --- a/src/http.go +++ b/src/http.go @@ -58,8 +58,8 @@ func (e *HTTPRequestCreateError) Error() string { type URLParameters map[string]string type HTTPOptionalParams struct { - Headers *http.Header - URLParameters *URLParameters + Headers http.Header + URLParameters URLParameters Body url.Values } @@ -97,8 +97,8 @@ func HTTPPostWithOpts(url string, opts *HTTPOptionalParams) (http.Header, []byte } func httpOptionalURL(url string, opts *HTTPOptionalParams) (string, error) { - if opts != nil && opts.URLParameters != nil { - url, urlErr := HTTPConstructURL(url, *opts.URLParameters) + if opts != nil { + url, urlErr := HTTPConstructURL(url, opts.URLParameters) if urlErr != nil { return url, &HTTPRequestCreateError{URL: url, Err: urlErr} @@ -110,8 +110,8 @@ func httpOptionalURL(url string, opts *HTTPOptionalParams) (string, error) { func httpOptionalHeaders(req *http.Request, opts *HTTPOptionalParams) { // Add headers - if opts != nil && opts.Headers != nil && req != nil { - for k, v := range *opts.Headers { + if opts != nil && req != nil { + for k, v := range opts.Headers { req.Header.Add(k, v[0]) } } |
