function RestAuthenticationController::getRequestFormat
Same name and namespace in other branches
- 11.x core/modules/rest/src/Controller/RestAuthenticationController.php \Drupal\rest\Controller\RestAuthenticationController::getRequestFormat()
Gets the format of the current request.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
Return value
string The format of the request.
File
-
core/
modules/ rest/ src/ Controller/ RestAuthenticationController.php, line 273
Class
- RestAuthenticationController
- Provides controllers for login, login status and logout via HTTP requests.
Namespace
Drupal\rest\ControllerCode
protected function getRequestFormat(Request $request) : string {
$format = $request->getRequestFormat();
if (!in_array($format, $this->serializerFormats)) {
throw new BadRequestHttpException("Unrecognized format: {$format}.");
}
return $format;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.