Closed normand1 closed 8 years ago
@normand1 this is because, canned reads the request accept
header to decide which file to respond with.
If the accept headers says i am expecting html
, then canned will return .get.html and if accept headers says 'i am expecting json' then canned will return .get.json.
When you just enter http://localhost:3000/test
in browser, browser is asking for give me html content for this url
, rather than give me json content for this url
.
If you want to debug the API, then use something like postman
For reference if you want to do the curl request try:
$ curl -H'Accept: application/json' http://localhost:3000/test
I have a simple file with a single Json object.
filename: index.get.json
After starting canned I open my browser and type http://localhost:3000/test into the address bar. I see no output in chrome, safari, or firefox, and I get this response from canned:
Chrome shows this error in the developer tools console:
From the terminal I type:
and get this response:
and this output from canned: