From b73e1489b06fd4546da6ba32697331584db02e71 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 20 Apr 2022 16:22:07 +0200 Subject: Refactor: Eliminate most uses of pointers in structs --- src/api.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/api.go') diff --git a/src/api.go b/src/api.go index a11c907..bb7d86b 100644 --- a/src/api.go +++ b/src/api.go @@ -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"}, } -- cgit v1.2.3