Skip to content

Commit

Permalink
Fix empty response
Browse files Browse the repository at this point in the history
When comparing to another empty struct this should just be checking if
the pointers match, which they don't. In the past this wasn't an issue
since it had no real bearing on the result-- as the body was parsed out
separately. Now that we are actually using this, we need to check
properly. Instead of using a nil I'm checking that the statuscode is
non-zero.
  • Loading branch information
jacksontj committed Dec 5, 2018
1 parent 3d66267 commit 8d8b466
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func (t *TricksterHandler) originRangeProxyHandler(cacheKey string, originRangeR
}

m.Lock()
if r == (&http.Response{}) || r.StatusCode != 200 {
if resp.StatusCode == 0 || r.StatusCode != 200 {
if r.StatusCode != 200 {
errorBody = b
}
Expand Down Expand Up @@ -761,7 +761,7 @@ func (t *TricksterHandler) originRangeProxyHandler(cacheKey string, originRangeR
}

m.Lock()
if r == (&http.Response{}) || r.StatusCode != 200 {
if resp.StatusCode == 0 || r.StatusCode != 200 {
if r.StatusCode != 200 {
errorBody = b
}
Expand Down Expand Up @@ -799,7 +799,7 @@ func (t *TricksterHandler) originRangeProxyHandler(cacheKey string, originRangeR
}

m.Lock()
if r == (&http.Response{}) || r.StatusCode != 200 {
if resp.StatusCode == 0 || r.StatusCode != 200 {
if r.StatusCode != 200 {
errorBody = b
}
Expand Down

0 comments on commit 8d8b466

Please sign in to comment.