From 65ab90a6d51755e5901434a3568f8163ca3e262f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nirguna=20Sarvaj=C3=B1a?= Date: Mon, 10 Jun 2013 19:26:48 +0530 Subject: [PATCH] lib/twitter/client.rb: Fixing issue with wrong signature being generated when multipart data is posted. The `request` method on Twitter::Client gets signature_params but doesn't pass that along to `request_setup` method breaking the signature on multipart posts. This fix adds the missing extra param to `request_setup` and uses it when generating the OAuth signature. --- lib/twitter/client.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/twitter/client.rb b/lib/twitter/client.rb index bf37e333c..377d57cf7 100644 --- a/lib/twitter/client.rb +++ b/lib/twitter/client.rb @@ -86,7 +86,7 @@ def put(path, params={}) # @param path [String] # @param params [Hash] # @return [Proc] - def request_setup(method, path, params) + def request_setup(method, path, params, signature_params) Proc.new do |request| if params.delete(:bearer_token_request) request.headers[:authorization] = bearer_token_credentials_auth_header @@ -99,13 +99,13 @@ def request_setup(method, path, params) end request.headers[:authorization] = bearer_auth_header else - request.headers[:authorization] = oauth_auth_header(method, path, params).to_s + request.headers[:authorization] = oauth_auth_header(method, path, signature_params).to_s end end end def request(method, path, params={}, signature_params=params) - request_setup = request_setup(method, path, params) + request_setup = request_setup(method, path, params, signature_params) connection.send(method.to_sym, path, params, &request_setup).env rescue Faraday::Error::ClientError raise Twitter::Error::ClientError