adamwiggins / rest-client
- Source
- Commits
- Network (69)
- Issues (6)
- Downloads (5)
- Wiki (1)
- Graphs
-
Branch:
master
-
Hi, I just installed v1.0 and am seeing errors.
appears to be (perhaps) an old require left hanging around here?:
geoff:~ glongman$ gem list | grep rest-client adamwiggins-rest-client (1.0) geoff:~ glongman$ irb >> require 'rubygems' => false >> require 'rest_client' LoadError: no such file to load -- /Library/Ruby/Gems/1.8/gems/adamwiggins-rest-client-1.0/lib/restclient/mixin/response from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Library/Ruby/Gems/1.8/gems/adamwiggins-rest-client-1.0/lib/restclient.rb:7 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Library/Ruby/Gems/1.8/gems/adamwiggins-rest-client-1.0/lib/rest_client.rb:2 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require' from (irb):3 >>my env (Mac OSX 10.5.6):
ruby 1.8.6.114 rubygems 1.3.1Comments
-
redirects should be :get's and should get rid of params
4 comments Created 8 months ago by stellsmilike so :
module RestClient
class Requestdef execute execute_inner rescue Redirect => e @method = :get @payload = nil @url = e.url execute endend end
Comments
According to spec
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
this is only required for 303 redirection, but most server side libraries are going to keep using 302s. So switching to GET should definitely be the behavior for 303 redirection, and maybe should be a configurable option for 302.
bradediger
Wed Jun 17 13:00:32 -0700 2009
| link
Not only is this required for 303 redirection, per kgilpin's link, RFC2616 prohibits the current behavior. The most common behavior of user agents is that provided above -- the redirect is followed with GET and no payload. Above patch, with tests, at bradediger/rest-client@cdad894.
bradediger
Wed Jun 17 13:02:31 -0700 2009
| link
github didn't like my link. here it is: http://bit.ly/ePiI8
archiloque
Sat Dec 26 04:09:21 -0800 2009
| link
-
raw_response.rb and mixin/response.rb didn't make it into the 1.0 gem.
Comments
oops I closed this one (didn't mean to) http://github.com/adamwiggins/rest-client/issues/closed/#issue/2
-
It's just the convention
Comments
-
In the current version, v1.0.4, rest-client will only attempt to inflate the server response for
HTTP 2XX(success-based) responses. This behavior is unexpected and counter-to the Rails convention of providingErrordetails inHTTP 422(Unprocessable Entity) - or at least non-200- responses.The offending code can be found here, in today's source. As you can see,
deflateis only executed for successful responses, whereas unsuccessful responses just get stuffed - while still deflated - into the response, rendering the exception.response.body generally unusable.
Comments
archiloque
Sat Dec 26 06:23:47 -0800 2009
| link
-
Hello,
Given the following which returns 204/"No Content":
$ curl -v -X POST -d count=1 -u foo:bar http://localhost:8003/das/reservation [snip]
POST /das/reservation HTTP/1.1 Authorization: Basic YmlfIFJfe9pbg== User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10 Host: localhost:8003 Accept: / Content-Length: 7 Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 204 No Content
< Server: Yaws/1.84 Yet Another Web Server
< Date: Thu, 01 Oct 2009 19:02:04 GMT
< Content-Length: 112
< Content-Type: text/html
[snip]Then why does the rest-client equivalent call return nil?:
irb(main):209:0> res = RestClient::Resource.new("http://localhost:8003",:user=>'foo',:password=>'bar')
=> #<RestClient::Resource:0xb6e5ce1c... irb(main):210:0> response_204 = res['das/reservation'].post "count=1"
=> nilI expected a Response object with a code of 204 and a to_s of "" (i.e. empty HTTP body) to be consistent with e.g.:
irb(main):200:0> response = res['das/message_count'].get
=> "3" irb(main):201:0> response.code
=> 200Is this behavior by design, or am I doing something wrong?
And, thank you for RestClient, I really like it.
Edward Garson
Comments
I came across this same issue, and so took a fork of the code and put in a fix so that it returns a response object with an empty ("") body for "204 No Content" responses, which then lets you also get to all the returned headers etc as with any other response.
I've sent a pull request to Adam so that he can take a look at it and decide whether to roll the fix into the main repo, but if you want to try it out in the meantime, you can try my fork - http://github.com/edraper/rest-client
archiloque
Sat Dec 26 04:28:52 -0800 2009
| link
will be in next version as http://github.com/archiloque/rest-client/commit/e4d01c7688abbde405098824959ef24397938fbb
-
'Accept' as a header key gets overridden
0 comments Created about 1 month ago by darkhelmetRestClient.get('http://example.com', 'Accept' => '/') results in a request with application/xml as the Accept type.
Using :accept as the key works, but not the literal string of what the header is. I believe the proper key should work too.
Comments





looks like the mixins folder didn't make it into the gem perhaps?
Same issue here.
FYI, manually adding in the mixin/response.rb and raw_response.rb (another missing file) appears to fix all issues.
yeah I noticed that too. Ended up installing the previous version - the gem that depends on this one is happy now