$this->parameters = [];
- // Check if the HTTP method ist OPTIONS and return the special Options Module with the possible HTTP methods
+ // Check if the HTTP method is OPTIONS and return the special Options Module with the possible HTTP methods
if ($this->args->getMethod() === static::OPTIONS) {
$routeOptions = $dispatcher->getOptions($cmd);
{
}
- /**
- * Module OPTIONS method to process submitted data
- *
- * Extend this method if the module is supposed to process OPTIONS requests.
- * Doesn't display any content
- *
- * @param string[] $request The $_REQUEST content
- */
- protected function options(array $request = [])
- {
- }
-
/**
* {@inheritDoc}
*/
case Router::PUT:
$this->put($request);
break;
- case Router::OPTIONS:
- $this->options($request);
- break;
}
$timestamp = microtime(true);
*/
class Options extends BaseModule
{
- protected function options(array $request = [])
+ protected function rawContent(array $request = [])
{
- $allowedMethods = $this->parameters['AllowedMethods'] ?? [];
-
- if (empty($allowedMethods)) {
- $allowedMethods = Router::ALLOWED_METHODS;
- }
+ $allowedMethods = $this->parameters['AllowedMethods'] ?? Router::ALLOWED_METHODS;
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
$this->response->setHeader(implode(',', $allowedMethods), 'Allow');
self::assertEquals([
'Allow' => [implode(',', [Router::GET, Router::POST])],
ICanCreateResponses::X_HEADER => ['blank'],
- 'Content-Type'
], $response->getHeaders());
self::assertEquals(implode(',', [Router::GET, Router::POST]), $response->getHeaderLine('Allow'));
}