Subject: | On PUT requests, returning 0 from resource_exists fails to produce 404 |
I am building a REST server based on Web::Machine (which I already knew from Erlang) and would like to use PUT requests in addition to GET, POST, and DELETE.
With GET and POST, a zero return value from resource_exists causes 404 as expected.
But somehow this does not apply to PUT. . . I am certain my application is returning 0 from resource_exists in both of the following cases:
$ # attempt POST to non-existent resource
$ curl -w '%{http_code}\n' http://root:immutable@localhost:5000/privhiqsory -X POST -H "Content-Type: application/json"
Not Found404
$ # attempt PUT to non-existent resource
curl -w '%{http_code}\n' http://root:immutable@localhost:5000/privhiqsory -X PUT -H "Content-Type: application/json"
null
200
If this is not a bug, please tell me the right way to elicit a 404 on a PUT request.