Handle request error
This commit is contained in:
parent
56d13c2b46
commit
b16089e5ae
1 changed files with 5 additions and 7 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue