some brave souls decided to return 202 for get requests

This commit is contained in:
Ted Unangst 2020-09-27 17:59:11 -04:00
parent 60c27f27fc
commit 534691a61a
1 changed files with 6 additions and 2 deletions

View File

@ -176,8 +176,12 @@ func fetchsome(url string) ([]byte, error) {
return nil, err return nil, err
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != 200 { switch resp.StatusCode {
return nil, fmt.Errorf("not 200: %d %s", resp.StatusCode, url) case 200:
case 201:
case 202:
default:
return nil, fmt.Errorf("http get not 200: %d %s", resp.StatusCode, url)
} }
var buf bytes.Buffer var buf bytes.Buffer
limiter := io.LimitReader(resp.Body, 10*1024*1024) limiter := io.LimitReader(resp.Body, 10*1024*1024)