owncloud/core — pull request #5068 by tanghus (2013-10-01 18:57:12+00:00)
Title: Improved request

I had to close #5038 because of #5037 and github wouldn't make me update or delete the branch, so here's a new one.

* Add patch method to OC_Route
* Exception when e.g. accessing $request->get if the current HTTP method is POST. Makes it a helluva lot easier to find errors in your cut'n'paste code ;)
* Add patch method to OC_Route
* Add PATCH and PUT accessors to Request. PATCH returns an array like GET and POST. PUT returns a once-only stream respource inspired by @DeepDiver1975 s commented out implementation.
* Moved POST json parsing to Request.
* Document accessors in IRequest.
* And unit tests :smile_cat:

I though a lot about what to do with the `php://input` that can only be read once, and I think this is the best approach. PATCH requests are per definition not big - otherwise you're Doing It Wrong - and if properly documented a stream resource for PUT makes most sense. I though about making it conditional either by an argument or by the size of the request body, but it would just be too obfuscated what you would actually get.
In the currently implementation it is accesses from `->params` which imho is not very intuitive and semantically incorrect.
I've made it backwards compatible though, so it's still available there if it stems from a POST request.

@DeepDiver1975 @Raydiation @bartv2 @karlitschek