micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nested restful route is not working

coffeencoke opened this issue · comments

I believe this is a bug. Making a GET request using Resty to a URI that has a nested resource does not make the request to the full URI. Am I calling the resty command wrong?

The uri of a nested resource:

$ URI=http://localhost:3000/users/user003/skills/7385140.json

$ echo $URI
http://localhost:3000/users/user003/skills/7385140.json

Using Resty

$ resty GET $URI -H "SomeAccessToken: $TOKEN" | jshon
{
 "skills": [
  {
   ...
  }
 ]
}

The server log:

Started GET "/users/user003/skills.json" for 127.0.0.1 at 2012-07-24 10:34:59 -0500
Processing by Users::SkillsController#index as JSON
  Parameters: {"user_id"=>"user003"}
Completed 200 OK in 2ms (Views: 0.4ms)

Using Curl

The same request using curl.

$ curl $URI -H "IM-AccessToken: $TOKEN" | jshon
{
 "skill": {
  ...
 }
}

The server log:

Started GET "/users/user003/skills/7385140.json" for 127.0.0.1 at 2012-07-24 10:36:15 -0500
Processing by Users::SkillsController#show as JSON
  Parameters: {"user_id"=>"user003", "id"=>"7385140"}
Completed 200 OK in 2ms (Views: 0.4ms)

@coffeencoke Sorry for the late answer. (very late I should say)

that's a strange error indeed. what I would say is that it's happening because you call resty GET with an host:
I'll say that

$ resty http://localhost:3000
$ GET /users/user003/skills/7385140.json

would do the job

@coffeencoke closing the issue, feel free to reopen it if needed :)