Skip to content

Commit

Permalink
lib/twitter/client.rb: Fixing issue with wrong signature being genera…
Browse files Browse the repository at this point in the history
…ted 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.
  • Loading branch information
NirgunaSarvajna committed Jun 10, 2013
1 parent 54bdde1 commit 65ab90a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/twitter/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 65ab90a

Please sign in to comment.