diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2016-01-05 21:05:19 +0100 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2016-01-05 21:05:19 +0100 |
commit | 5056ae228899c6277713054c5d7d0ddf945f7d27 (patch) | |
tree | 87239d3c6a6113a237cbe972af84f519dbf0038f /provider.go | |
parent | 32a12e8249253abe4e5486a44ddee42f7b8c991d (diff) |
cleanup
Diffstat (limited to 'provider.go')
-rw-r--r-- | provider.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/provider.go b/provider.go index 0c896e7..f8fdbb5 100644 --- a/provider.go +++ b/provider.go @@ -104,7 +104,7 @@ func (p *Provider) parse(resp *http.Response, v interface{}) (ns nextStep, err e body, err := ioutil.ReadAll(resp.Body) if err != nil { - return ns, err + return } defer resp.Body.Close() @@ -113,12 +113,10 @@ func (p *Provider) parse(resp *http.Response, v interface{}) (ns nextStep, err e switch resp.Header.Get("Content-Type") { case "application/problem+json": var p Problem - if err := json.Unmarshal(body, &p); err != nil { - return ns, err - } - if err, ok := urnErrors[p.Type]; ok { - p.Err = err + if err = json.Unmarshal(body, &p); err != nil { + return } + p.Err = urnErrors[p.Type] err = p case "application/json": err = json.Unmarshal(body, v) @@ -127,7 +125,7 @@ func (p *Provider) parse(resp *http.Response, v interface{}) (ns nextStep, err e default: err = errContentType } - return ns, err + return } func problem(resp *http.Response) error { |