Skip to content

HttpResponseHeader#http_reason is always 'unknown' #118

phiggins opened this Issue Jun 21, 2011 · 0 comments

2 participants


Discovered by @sdhull in this WebMock pull request.

This example code demonstrates the problem:

require 'em-http' do
  first ="").get
  first.callback { p [first.response_header.status, first.response_header.http_reason] }

  second ="").get
  second.callback { p [second.response_header.status, second.response_header.http_reason] }

  third ="").get
  third.callback { p [third.response_header.status, third.response_header.http_reason] }

  EM.add_timer(1) { EM.stop }

The output with em-http-request-0.3.0:

$ ruby -I. -e "gem 'em-http-request', '0.3.0' ; require 'test_em_http.rb'"
[301, "Moved Permanently"]
[200, "OK"]
[404, "Not Found"]

The output with em-http-request-1.0.0.beta.4:

$ ruby -I. -e "gem 'em-http-request', '1.0.0.beta.4' ; require 'test_em_http.rb'"
[301, "unknown"]
[404, "unknown"]
[200, "unknown"]
@igrigorik igrigorik closed this in e90aafa Jun 26, 2011
@mathieuravaux mathieuravaux added a commit to mathieuravaux/em-http-request that referenced this issue Aug 5, 2011
@mathieuravaux mathieuravaux Merge remote-tracking branch 'refs/remotes/igrigorik/master'
* refs/remotes/igrigorik/master:
  Add link to sinatra-synchrony
  Add em-eventsource.
  Response failed on a non-standard HTTP response (such as the twitter search API's 420 'Enhance your calm')
  allow reason to be nil
  woops, add status codes file
  return http status alongside response code, closes #118
  don't swallow connection errors, closes #117
  alias close to unbind on connection
  pass through connection errors, closes #96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.