Skip to content

Commit

Permalink
change how Request func works (does not throw error if not 200)
Browse files Browse the repository at this point in the history
  • Loading branch information
exelban committed Mar 4, 2021
1 parent c216d38 commit df2401c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ func Request(ctx context.Context, params RequestOpts) ([]byte, int, error) {
return nil, 0, err
}

if resp.StatusCode >= 400 {
return nil, resp.StatusCode, errors.New(string(body))
}

return body, resp.StatusCode, nil
}

Expand Down
4 changes: 2 additions & 2 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func TestRequest(t *testing.T) {
URL: ts.URL,
InjectBearer: true,
})
require.Error(t, err)
require.Nil(t, resp)
require.NoError(t, err)
require.NotNil(t, resp)
require.Equal(t, http.StatusBadRequest, code)
})

Expand Down

0 comments on commit df2401c

Please sign in to comment.