Closed josegonzalez closed 13 years ago
I can't merge in the pull request because
Instead I've manually added the other 3 commits to rest.php
(https://github.com/kvz/cakephp-rest-plugin/commit/6c5f34715d026b126d3cbb6984aeece72b1c93b2).
Thanks for your contributions again @josegonzalez, and let me know if you have a different opinion on the custom HTTP status code thing.
Will do, thanks for the heads up.
I have the following changes:
Sometimes I did not want to use the extraction method as it would be difficult to write the appropriate Set::extract() calls and easy to write the logic in my model. That makes my api much more testable as well since I don't need to make a call to the controller to test responses - the model response is already in the format I like.
Disabling the embedding of responses in the data key makes my api much easier to access, and combined with disabling of the meta data, makes the api much cleaner looking.
The current debug mode should never be set as a view variable. Perhaps this can be changed depending on your debug mode - only set it when not in production - but otherwise it's both pointless and somewhat ugly.
As far as HTTP Codes, I don't know if I made this change across all RestComponent calls, but it's useful since I am building an internal api and defining non-standard http status codes will help inform my consumer services much quicker as to why something failed, rather than parsing some message code.