New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RestClient.get should allow for header and params #397
Comments
Hi there, You've discovered a really unfortunate part of the RestClient API. I'm planning to rewrite this in a saner way in RestClient 3.0, but that's a long way off. In the meantime, this should work:
The |
Will below code also work (as per https://github.com/rest-client/rest-client) it looks like: RestClient::Request.execute( { :method => :get, :url => 'http://example.com', :headers => {:params => {:foo => 'bar', :baz => 'qux'}} }) Also, how can I see the request URL which was finally executed (with params etc.), I wanted to confirm that request was actually made to |
Yep, that looks right. For testing I usually enable RestClient logging (e.g. |
thanks @ab but is there any way to add parameters if the request URL already has parameters something like: RestClient::Request.execute( { :method => :get, :url => 'http://example.com?param1=value1', :headers => {:params => {:foo => 'bar', :baz => 'qux'}} }) The request URL formed from above is |
I'm also interested in that. Tried creating a Resource with a :params "header" instead of having it in the URL, but the headers are
I can do |
From the docs we have:
Shouldn't we therefore be able to call:
When I try this I get
Error: wrong number of arguments (3 for 1..2)
The text was updated successfully, but these errors were encountered: