From b16089e5ae6d96e71751071c2abdd618f015f0f6 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 5 Oct 2021 15:28:15 +0200 Subject: [PATCH] Handle request error --- vehicle/fiat/api.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/vehicle/fiat/api.go b/vehicle/fiat/api.go index c9778dd6e..a0295159d 100644 --- a/vehicle/fiat/api.go +++ b/vehicle/fiat/api.go @@ -47,13 +47,12 @@ func (v *API) request(method, uri string, body io.ReadSeeker) (*http.Request, er } req, err := request.New(method, uri, body, headers) - - // hack for pinAuth method - if strings.HasPrefix(uri, AuthURI) { - req.Header.Set("X-Api-Key", XAuthApiKey) - } - if err == nil { + // hack for pinAuth method + if strings.HasPrefix(uri, AuthURI) { + req.Header.Set("X-Api-Key", XAuthApiKey) + } + err = v.identity.Sign(req, body) } @@ -105,7 +104,6 @@ func (v *API) pinAuth(pin string) (string, error) { } req, err := v.request(http.MethodPost, uri, request.MarshalJSON(data)) - if err == nil { err = v.DoJSON(req, &res) }