Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed a compatibility issue w/ Faraday using Net::HTTP adapter #7

Merged
merged 1 commit into from

2 participants

@ivmaykov

Fixed a compatibility issue w/ Faraday using Net::HTTP adapter. Faraday creates a Net::HTTPGenericRequest directly (at https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http.rb#L55), which does not have a ::METHOD constant defined, so we have to use #method to get the HTTP method name.

Ilya Maykov Fixed a compatibility issue w/ Faraday using Net::HTTP adapter. Farad…
…ay creates a Net::HTTPGenericRequest directly, which does not have a ::METHOD constant defined, so we have to use #method to get the HTTP method name
7979cf3
@jfairbairn jfairbairn merged commit bd9f07e into jfairbairn:master
@jfairbairn
Owner

Sorry for the delay applying this.....

@ivmaykov

Cool, thanks! Do you plan to release a new version of the gem soon?

@jfairbairn
Owner

Done! :)

@ivmaykov

Cool, thanks! Now we can use an official version instead of our internally-built one.

FYI, the date field in the gemspec is hardcoded to Sept 12, 2011, so all releases since 0.3.5 show the same date at http://rubygems.org/gems/em-net-http. It will probably generate the release date automatically if you remove the explicit date from your .gemspec file ...

@jfairbairn
Owner

Hmm, yeah. That came about because I originally used jeweler to generate the gemspec and release the gem. What a load of unnecessary complexity! I've now stripped out the gemspec a bit, and it's taking the gem version from the VERSION file. I've pushed the gem to rubygems.org for good measure. sigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 9, 2013
  1. Fixed a compatibility issue w/ Faraday using Net::HTTP adapter. Farad…

    Ilya Maykov authored
    …ay creates a Net::HTTPGenericRequest directly, which does not have a ::METHOD constant defined, so we have to use #method to get the HTTP method name
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/em-net-http.rb
View
3  lib/em-net-http.rb
@@ -135,7 +135,8 @@ def request(req, body = nil, &block)
headers['content-type'] ||= "application/x-www-form-urlencoded"
t0 = Time.now
- httpreq = EM::HttpRequest.new(uri).send(req.class::METHOD.downcase.to_sym, opts)
+ request_method = (req.respond_to?(:method) ? req.method : req.class::METHOD).downcase.to_sym
+ httpreq = EM::HttpRequest.new(uri).send(request_method, opts)
f=Fiber.current
Something went wrong with that request. Please try again.