Skip to content

Commit

Permalink
drop nil parameters passed as additional args
Browse files Browse the repository at this point in the history
  • Loading branch information
mojodna committed May 26, 2009
1 parent 5c8aae1 commit 3fa4dab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/oauth/consumer.rb
Expand Up @@ -294,7 +294,7 @@ def create_http_request(http_method, path, *arguments)
http_method = http_method.to_sym

if [:post, :put].include?(http_method)
data = arguments.shift
data = (arguments.shift || {}).reject { |k,v| v.nil? }
end

headers = arguments.first.is_a?(Hash) ? arguments.shift : {}
Expand Down

4 comments on commit 3fa4dab

@ambivalence
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

This change breaks the case when data is not a Hash. When data is a string, this change results in data becoming an empty array.

Can you change this to the following?

    data = arguments.shift
    data.reject! { |k,v| v.nil? } if data.is_a?(Hash)

Thanks!

@jwagener
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

this breaks my oauth activeresource lib. Please fix it.

cheers :)

@peymano
Copy link

@peymano peymano commented on 3fa4dab Jul 4, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping? Please fix!

@mojodna
Copy link
Owner Author

@mojodna mojodna commented on 3fa4dab Jul 6, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.