Skip to content

HttpResponseHeader#http_reason is always 'unknown' #118

Closed
phiggins opened this Issue Jun 21, 2011 · 0 comments

2 participants

@phiggins

Discovered by @sdhull in this WebMock pull request.

This example code demonstrates the problem:

require 'em-http'

EM.run do
  first = EM::HttpRequest.new("http://google.com").get
  first.callback { p [first.response_header.status, first.response_header.http_reason] }

  second = EM::HttpRequest.new("http://www.google.com").get
  second.callback { p [second.response_header.status, second.response_header.http_reason] }

  third = EM::HttpRequest.new("http://www.google.com/foo").get
  third.callback { p [third.response_header.status, third.response_header.http_reason] }

  EM.add_timer(1) { EM.stop }
end

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
bfd4f4d
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.