Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rvm:
- "1.9.2"
- "1.9.3"
- "2.0.0"
- "2.1.2"
- jruby-18mode # JRuby in 1.8 mode
- jruby-19mode # JRuby in 1.9 mode
- rbx-18mode
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Client

class << self
extend Forwardable
def_delegators :new, :head, :get, :put, :post, :delete
def_delegators :new, :head, :get, :put, :patch, :post, :delete
end

def self.new(*a, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/client/adapter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(app)
@app = app
end

%w[ options get head post put delete trace connect ].each do |method|
%w[ options get head post put patch delete trace connect ].each do |method|
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
def #{method}(url, headers = {}, body = nil, &block)
request('#{method.upcase}', url, headers, body, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/client/adapter/simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def #{method}(url, headers = {}, query_params = {}, &block)
RUBY
end

%w[ post put ].each do |method|
%w[ post put patch ].each do |method|
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
def #{method}(url, headers = {}, body_or_params = nil, query_params = {}, &block)
request('#{method.upcase}', url, headers, body_or_params, query_params, &block)
Expand Down
11 changes: 6 additions & 5 deletions lib/rack/client/handler/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ def net_connection_for(request)

def net_request_for(request)
klass = case request.request_method
when 'DELETE' then Net::HTTP::Delete
when 'GET' then Net::HTTP::Get
when 'HEAD' then Net::HTTP::Head
when 'POST' then Net::HTTP::Post
when 'PUT' then Net::HTTP::Put
when 'DELETE' then Net::HTTP::Delete
when 'GET' then Net::HTTP::Get
when 'HEAD' then Net::HTTP::Head
when 'POST' then Net::HTTP::Post
when 'PUT' then Net::HTTP::Put
when 'PATCH' then Net::HTTP::Patch
end

net_request = klass.new(request.fullpath, Headers.from(request.env).to_http)
Expand Down
13 changes: 13 additions & 0 deletions spec/spec_apps/patch.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'sinatra/base'

class Patch < Sinatra::Base
patch '/sum' do
a, b = params[:a], params[:b]
a = a.nil? ? 0 : a.to_i
b = b.nil? ? 0 : b.to_i

(a + b).to_s
end
end

run Patch
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def mri_187?
end

RSpec.configure do |config|
config.color_enabled = true
#config.filter_run :focused => true
#config.run_all_when_everything_filtered = true
config.include(HandlerHelper)
Expand Down