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/api.go | |
| parent | 63dfe633c7e62f570d44af6e0ea17967155cb5db (diff) | |
Refactor: Eliminate most uses of pointers in structs
Diffstat (limited to 'src/api.go')
| -rw-r--r-- | src/api.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -28,7 +28,7 @@ func (server *Server) apiAuthenticated(method string, endpoint string, opts *HTT if opts.Headers != nil { opts.Headers.Add(headerKey, headerValue) } else { - opts.Headers = &http.Header{headerKey: {headerValue}} + opts.Headers = http.Header{headerKey: {headerValue}} } return HTTPMethodWithOpts(method, url, opts) } @@ -54,8 +54,8 @@ func (server *Server) APIInfo() error { if bodyErr != nil { return bodyErr } - structure := &ServerProfileInfo{} - jsonErr := json.Unmarshal(body, structure) + structure := ServerProfileInfo{} + jsonErr := json.Unmarshal(body, &structure) if jsonErr != nil { return jsonErr @@ -67,7 +67,7 @@ func (server *Server) APIInfo() error { } func (server *Server) APIConnectWireguard(profile_id string, pubkey string) (string, string, error) { - headers := &http.Header{ + headers := http.Header{ "content-type": {"application/x-www-form-urlencoded"}, "accept": {"application/x-wireguard-profile"}, } @@ -86,7 +86,7 @@ func (server *Server) APIConnectWireguard(profile_id string, pubkey string) (str } func (server *Server) APIConnectOpenVPN(profile_id string) (string, string, error) { - headers := &http.Header{ + headers := http.Header{ "content-type": {"application/x-www-form-urlencoded"}, "accept": {"application/x-openvpn-profile"}, } |
