You are here

protected function FileUploadResource::getBaseRouteRequirements in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/rest/resource/FileUploadResource.php \Drupal\file\Plugin\rest\resource\FileUploadResource::getBaseRouteRequirements()
  2. 9 core/modules/file/src/Plugin/rest/resource/FileUploadResource.php \Drupal\file\Plugin\rest\resource\FileUploadResource::getBaseRouteRequirements()

Gets the base route requirements for a particular method.

Parameters

$method: The HTTP method to be used for the route.

Return value

array An array of requirements for parameters.

Overrides ResourceBase::getBaseRouteRequirements

1 call to FileUploadResource::getBaseRouteRequirements()
FileUploadResource::getBaseRoute in core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
Gets the base route for a particular method.

File

core/modules/file/src/Plugin/rest/resource/FileUploadResource.php, line 581

Class

FileUploadResource
File upload resource.

Namespace

Drupal\file\Plugin\rest\resource

Code

protected function getBaseRouteRequirements($method) {
  $requirements = parent::getBaseRouteRequirements($method);

  // Add the content type format access check. This will enforce that all
  // incoming requests can only use the 'application/octet-stream'
  // Content-Type header.
  $requirements['_content_type_format'] = 'bin';
  return $requirements;
}