diff --git a/lib/faraday/adapter/net_http.rb b/lib/faraday/adapter/net_http.rb index 1a4244fac..30dce003d 100644 --- a/lib/faraday/adapter/net_http.rb +++ b/lib/faraday/adapter/net_http.rb @@ -60,12 +60,10 @@ def call(env) end def create_request(env) - request = Net::HTTPGenericRequest.new \ - env[:method].to_s.upcase, # request method - !!env[:body], # is there request body - :head != env[:method], # is there response body - env[:url].request_uri, # request uri path - env[:request_headers] # request headers + klass = Net::HTTP.const_get(env[:method].to_s.capitalize) + request = klass.new \ + env[:url].request_uri, # request uri path + env[:request_headers] # request headers if env[:body].respond_to?(:read) request.body_stream = env[:body]