summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-10-04 09:05:20 -0700
committerBart Visscher <bartv@thisnet.nl>2013-10-04 09:05:20 -0700
commitbae121b16dbabed3ec307ea58e3b8a73ab27161c (patch)
treecda1d903087731cec2f2eab69f1225b51db6b272 /lib/public
parentfd34c969d233724399651f6481f32d5c7c1ee18b (diff)
parentaedc427ffd73f9ab249f1722c197205bc366ed8d (diff)
downloadnextcloud-server-bae121b16dbabed3ec307ea58e3b8a73ab27161c.tar.gz
nextcloud-server-bae121b16dbabed3ec307ea58e3b8a73ab27161c.zip
Merge pull request #5068 from owncloud/improved_request
Improved request
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/irequest.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/public/irequest.php b/lib/public/irequest.php
index 9f335b06f2a..054f15d9eb2 100644
--- a/lib/public/irequest.php
+++ b/lib/public/irequest.php
@@ -22,6 +22,28 @@
namespace OCP;
+/**
+ * This interface provides an immutable object with with accessors to
+ * request variables and headers.
+ *
+ * Access request variables by method and name.
+ *
+ * Examples:
+ *
+ * $request->post['myvar']; // Only look for POST variables
+ * $request->myvar; or $request->{'myvar'}; or $request->{$myvar}
+ * Looks in the combined GET, POST and urlParams array.
+ *
+ * If you access e.g. ->post but the current HTTP request method
+ * is GET a \LogicException will be thrown.
+ *
+ * NOTE:
+ * - When accessing ->put a stream resource is returned and the accessor
+ * will return false on subsequent access to ->put or ->patch.
+ * - When accessing ->patch and the Content-Type is either application/json
+ * or application/x-www-form-urlencoded (most cases) it will act like ->get
+ * and ->post and return an array. Otherwise the raw data will be returned.
+ */
interface IRequest {
@@ -85,12 +107,4 @@ interface IRequest {
function getCookie($key);
- /**
- * Returns the request body content.
- *
- * @param Boolean $asResource If true, a resource will be returned
- * @return string|resource The request body content or a resource to read the body stream.
- * @throws \LogicException
- */
- function getContent($asResource = false);
}