micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).
MIT License
2.65k stars 143 forks source link

nested restful route is not working #36

Closed coffeencoke closed 7 years ago

coffeencoke commented 12 years ago

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)
AdrieanKhisbe commented 7 years ago

@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

AdrieanKhisbe commented 7 years ago

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