diff options
author | Stanimir Bozhilov <stanimir@audriga.com> | 2022-09-20 14:18:26 +0200 |
---|---|---|
committer | Stanimir Bozhilov <stanimir@audriga.com> | 2022-09-20 16:18:52 +0200 |
commit | f0dbe1148aa6d4099c445e4c6bd3a625acf300e5 (patch) | |
tree | 4fe0ae46aa48365849294574d933876b7be35466 /lib | |
parent | 3950deb42fa9c7c5805e5047d07c988d59e57eb9 (diff) | |
download | nextcloud-server-f0dbe1148aa6d4099c445e4c6bd3a625acf300e5.tar.gz nextcloud-server-f0dbe1148aa6d4099c445e4c6bd3a625acf300e5.zip |
Add support for application/scim+json content type
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 496a845dd4a..9a7014b36c1 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -26,6 +26,7 @@ declare(strict_types=1); * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <vincent@nextcloud.com> * @author Simon Leiner <simon@leiner.me> + * @author Stanimir Bozhilov <stanimir@audriga.com> * * @license AGPL-3.0 * @@ -404,6 +405,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { && $this->getHeader('Content-Length') !== '' && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false && strpos($this->getHeader('Content-Type'), 'application/json') === false + && strpos($this->getHeader('Content-Type'), 'application/scim+json') === false ) { if ($this->content === false) { throw new \LogicException( @@ -437,6 +439,15 @@ class Request implements \ArrayAccess, \Countable, IRequest { $this->items['post'] = $params; } } + // 'application/scim+json' must be decoded manually. + } elseif (strpos($this->getHeader('Content-Type'), 'application/scim+json') !== false) { + $params = json_decode(file_get_contents($this->inputStream), true); + if ($params !== null && \count($params) > 0) { + $this->items['params'] = $params; + if ($this->method === 'POST') { + $this->items['post'] = $params; + } + } // Handle application/x-www-form-urlencoded for methods other than GET // or post correctly |