Open txpokey opened 10 years ago
Ok, so I got these test by hand results... I didn't do all of the uri in the grails documentation
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rest/stores # index will run
curl -i -H "Accept: application/json" -X GET http://localhost:8080/rest/stores/2 # show will run
curl -i -H "Accept: application/json" -X DELTE http://localhost:8080/rest/stores/2 # delete
so when the "stores" curl command is run you get:
curl -i -H "Accept: application/json" -X GET http://localhost:8080/8080/sci.reststore/stores
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Sun, 24 Aug 2014 01:46:08 GMT[{"class":"demo.Store","id":1,"location":"Tucson, AZ","name":"Store 1"},{"class":"demo.Store","id":2,"location":"Los Angeles, CA","name":"Store 2"}]
so when the delete runs:
... HTTP/1.1 204 No Content Server: Apache-Coyote/1.1 Date: Sun, 24 Aug 2014 01:48:44 GMT
and if you re-run the get on the deleted store:
HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 Content-Length: 0 Date: Sun, 24 Aug 2014 01:49:16 GMT
I got this while testing for HAL :
curl -i -H "Accept: application/hal+json" http://localhost:8080/rest/stores
HTTP/1.1 406 Not Acceptable Server: Apache-Coyote/1.1 Content-Length: 0 Date: Sun, 24 Aug 2014 02:21:56 GMT
none of the tests in the project do anything, except for the reviews controller. that code came out of the scaffolding.
then I run "/stores" from the browser, it wants to render to show.gsp, which doesn't exist. this is exactly the problem I am seeing in my own, 1st attempt at using RestfulController. (After digging out curl(1), and re-reading the grails documentation, I was able to run some use cases by hand, which I document in a follow up comment).
So the reasons I opened this ticket :
p.s. here's a nice link I used w.r.t to testing out the REST via curl