Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-07-20 22:30:39 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2016-07-20 23:05:43 +0300
commite42f2f26504e3fcf975c15c3d3732646e819f37e (patch)
tree480716a1d52023beb64b39551eb83b4ae217e7a7 /lib/public/AppFramework/Controller.php
parent020a2a6958e48f7a3a29daa2235f6729980850af (diff)
AppFramework do not get default response
The OCSResponse differs from other responses in that it defaults to XML. However we fell back to json by default. This makes sure that if nothing is set we don't pass anything. Which defaults then to the controllers default (which is often 'json') but in the case of the OCSResponse 'xml'.
Diffstat (limited to 'lib/public/AppFramework/Controller.php')
-rw-r--r--lib/public/AppFramework/Controller.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php
index daf6018cd12..c6baa5e30c1 100644
--- a/lib/public/AppFramework/Controller.php
+++ b/lib/public/AppFramework/Controller.php
@@ -104,8 +104,9 @@ abstract class Controller {
* @param string $acceptHeader
* @return string the responder type
* @since 7.0.0
+ * @since 9.1.0 Added default parameter
*/
- public function getResponderByHTTPHeader($acceptHeader) {
+ public function getResponderByHTTPHeader($acceptHeader, $default='json') {
$headers = explode(',', $acceptHeader);
// return the first matching responder
@@ -119,8 +120,8 @@ abstract class Controller {
}
}
- // no matching header defaults to json
- return 'json';
+ // no matching header return default
+ return $default;
}