Fix check status code

Signed-off-by: Xin Zhang <ahjdzx1990@gmail.com>
This commit is contained in:
Xin Zhang 2019-10-12 16:07:00 +08:00
parent 9a37535b1b
commit 7c6a9d7568
1 changed files with 1 additions and 1 deletions

View File

@ -267,7 +267,7 @@ func (p *Pusher) push(method string) error {
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != 202 { if resp.StatusCode != 200 && resp.StatusCode != 202 {
body, _ := ioutil.ReadAll(resp.Body) // Ignore any further error as this is for an error message only. body, _ := ioutil.ReadAll(resp.Body) // Ignore any further error as this is for an error message only.
return fmt.Errorf("unexpected status code %d while pushing to %s: %s", resp.StatusCode, p.fullURL(), body) return fmt.Errorf("unexpected status code %d while pushing to %s: %s", resp.StatusCode, p.fullURL(), body)
} }