Created
October 25, 2016 13:43
-
-
Save gabrielschulhof/44a70b1834db51419fb170e472f33554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response payload calculation: | |
request.respond() | |
-> retrieve | |
-> OK, request.target.transform( request.target.properties, request.options ) | |
-> update | |
-> OK, no payload [1] | |
-> delete | |
-> OK, no payload [1] | |
-> create | |
-> INTERNAL_SERVER_ERROR, reject( "Missing payload" ) | |
request.respond( data ) | |
-> data instanceof Resource | |
-> retrieve | |
-> OK, data.transform( data.properties, request.options ) | |
-> update | |
-> OK, data.transform( data.properties, request.options ) [0] | |
-> delete | |
-> OK, data.transform( data.properties, request.options ) [0] | |
-> create | |
-> isValidResource( data ) | |
-> RESOURCE_CREATED, data | |
-> resource not valid | |
-> INTERNAL_SERVER_ERROR, reject( "payload not a resource" ) | |
-> data is plain object | |
-> retrieve | |
-> OK, request.target.transform( data, request.options ) | |
-> update | |
-> OK, request.target.transform( data, request.options ) [0] | |
-> delete | |
-> OK, request.target.transform( data, request.options ) [0] | |
-> create | |
-> isValidResource( data ) | |
-> RESOURCE_CREATED, data | |
-> resource not valid | |
-> INTERNAL_SERVER_ERROR, reject( "payload not a resource" ) | |
[0] Should these be "no payload", even if data was given? | |
[1] Conversely to [0], should these be | |
request.target.transform( request.target.properties, request.options ) | |
like the "retrieve" case? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Depends (based on the OCF spec): for update it MAY have data, for delete it doesn't have data.