Skip to content

Commit

Permalink
fix for handling responses with no body
Browse files Browse the repository at this point in the history
  • Loading branch information
inconshreveable committed May 27, 2014
1 parent 8fa9189 commit b6f7258
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ngrok/proto/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ func (h *Http) readResponses(tee *conn.Tee, lastTxn chan *HttpTxn) {
_, _ = httputil.DumpResponse(resp, true)

txn.Resp = &HttpResponse{Response: resp}
txn.Resp.BodyBytes, txn.Resp.Body, err = extractBody(resp.Body)
if err != nil {
tee.Warn("Failed to extract response body: %v", err)
// apparently, Body can be nil in some cases
if resp.Body != nil {
txn.Resp.BodyBytes, txn.Resp.Body, err = extractBody(resp.Body)
if err != nil {
tee.Warn("Failed to extract response body: %v", err)
}
}

h.Txns.In() <- txn
Expand Down

0 comments on commit b6f7258

Please sign in to comment.