If the body of the request is not defined, the app is crashing - e.g. just try to create a new creature with curl http://localhost:1337/creatures/new -X POST and the example will crash with the following callstack:
D:\Projects\node\node_modules\restful\node_modules\resourceful\lib\resourceful\resource.js:209
attrs.ctime = attrs.mtime = Date.now();
^
TypeError: Cannot set property 'mtime' of undefined
at Function.create (D:\Projects\node\node_modules\restful\node_modules\resourceful\lib\resourceful\resource.js:209:3
1)
at Object. (D:\Projects\node\node_modules\restful\lib\restful.js:359:14)
at apply (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:434:19)
at _every (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:28:9)
at [object Object].invoke (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:429:5)
at IncomingMessage.parseAndInvoke (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\http\ind
ex.js:175:10)
at IncomingMessage.g (events.js:156:14)
at IncomingMessage.emit (events.js:64:17)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at Socket.ondata (http.js:1506:22)
I think that should be handled more gracefully to make the server more robust.
Sorry - only seems to be a problem with v0.2.2 - which is the default if installing just via 'npm install restful'. If using v0.4.4 the problem no longer exists.
If the body of the request is not defined, the app is crashing - e.g. just try to create a new creature with curl http://localhost:1337/creatures/new -X POST and the example will crash with the following callstack:
D:\Projects\node\node_modules\restful\node_modules\resourceful\lib\resourceful\resource.js:209 attrs.ctime = attrs.mtime = Date.now(); ^ TypeError: Cannot set property 'mtime' of undefined at Function.create (D:\Projects\node\node_modules\restful\node_modules\resourceful\lib\resourceful\resource.js:209:3 1) at Object. (D:\Projects\node\node_modules\restful\lib\restful.js:359:14)
at apply (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:434:19)
at _every (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:28:9)
at [object Object].invoke (D:\Projects\node\node_modules\restful\node_modules\director\lib\director\router.js:429:5)
ex.js:175:10) at IncomingMessage.g (events.js:156:14) at IncomingMessage.emit (events.js:64:17) at HTTPParser.parserOnMessageComplete as onMessageComplete at Socket.ondata (http.js:1506:22)
I think that should be handled more gracefully to make the server more robust.