Fix to parse API error

This commit is contained in:
178inaba 2017-04-19 14:32:53 +09:00
parent fe02b9e6af
commit aa0f9563ac
4 changed files with 21 additions and 7 deletions

View file

@ -4,7 +4,6 @@ import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
@ -95,7 +94,7 @@ func (c *Client) streaming(ctx context.Context, p string, tag string) (chan Even
req.Header.Set("Authorization", "Bearer "+c.config.AccessToken)
resp, err = c.Do(req)
if resp != nil && resp.StatusCode != 200 {
err = fmt.Errorf("bad request: %v", resp.Status)
err = parseAPIError("bad request", resp)
}
}
if err == nil {