Handle request error

This commit is contained in:
andig 2021-10-05 15:28:15 +02:00
parent 56d13c2b46
commit b16089e5ae

View file

@ -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)
}