Skip to content

Commit

Permalink
Merge pull request philchia#49 from ms2008/fix/watchupdate-slips
Browse files Browse the repository at this point in the history
fix long polling slips due to multiple apollo instances would not ins…
  • Loading branch information
philchia authored Jul 28, 2019
2 parents ef4758d + 4e8dd48 commit 3ef0836
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion request.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package agollo

import (
"errors"
"io"
"io/ioutil"
"net/http"
)

var ErrorStatusNotOK = errors.New("http resp code not ok")

// this is a static check
var _ requester = (*httprequester)(nil)

Expand Down Expand Up @@ -36,5 +39,5 @@ func (r *httprequester) request(url string) ([]byte, error) {

// Diacard all body if status code is not 200
io.Copy(ioutil.Discard, resp.Body)
return nil, nil
return nil, ErrorStatusNotOK
}
2 changes: 1 addition & 1 deletion request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestRequest(t *testing.T) {
rw.WriteHeader(http.StatusInternalServerError)
}))
bts, err = request.request(serv.URL)
if err != nil {
if err != nil && err != ErrorStatusNotOK {
t.Error(err)
}

Expand Down

0 comments on commit 3ef0836

Please sign in to comment.