I am performing a GET request in Ruby and not sure why I am sometimes getting the following stack trace.
RestClient::MethodNotAllowed: 405 Method Not Allowed
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/abstract_response.rb:48:in return!
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/request.rb:269:in process_result
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/request.rb:212:in block in transmit
/usr/lib/ruby/2.0.0/net/http.rb:852:in start
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/request.rb:206:in transmit
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/request.rb:68:in execute
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/request.rb:35:in execute
[GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient.rb:70:in get
It's especially confusing because the stack trace does not say which method is not allowed. What might be the cause of this error?
You could try to
rescue
the exception. This way you can access thehttp_body
of the response. If you're lucky, this might give you an insight on what went wrong.