chg: [API] GET requests on restsearch with no parameters are no longer allowed.

- warn the user of the use of GET queries with posted JSON bodies
pull/6232/head
iglocska 2020-08-24 09:04:30 +02:00
parent 158c9aea66
commit 242d25d5e4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 3 additions and 0 deletions

View File

@ -1242,6 +1242,9 @@ class AppController extends Controller
);
$exception = false;
$filters = $this->_harvestParameters($filterData, $exception, $this->_legacyParams);
if (empty($filters) && $this->request->is('get')) {
throw new InvalidArgumentException(__('Restsearch queries using GET and no parameters are not allowed. If you have passed parameters via a JSON body, make sure you use POST requests.'));
}
if (empty($filters['returnFormat'])) {
$filters['returnFormat'] = 'json';
}