mirror of
https://github.com/friendica/friendica
synced 2025-04-26 18:30:11 +00:00
Use Args::getMethod() at various places
This commit is contained in:
parent
ee2a15d822
commit
4e67bfed8d
5 changed files with 6 additions and 15 deletions
|
@ -74,11 +74,6 @@ class Router
|
|||
/** @var RouteCollector */
|
||||
protected $routeCollector;
|
||||
|
||||
/**
|
||||
* @var string The HTTP method
|
||||
*/
|
||||
private $httpMethod;
|
||||
|
||||
/**
|
||||
* @var array Module parameters
|
||||
*/
|
||||
|
@ -139,10 +134,6 @@ class Router
|
|||
$this->logger = $logger;
|
||||
$this->dice_profiler_threshold = $config->get('system', 'dice_profiler_threshold', 0);
|
||||
|
||||
$httpMethod = $this->server['REQUEST_METHOD'] ?? self::GET;
|
||||
|
||||
$this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
|
||||
|
||||
$this->routeCollector = isset($routeCollector) ?
|
||||
$routeCollector :
|
||||
new RouteCollector(new Std(), new GroupCountBased());
|
||||
|
@ -271,12 +262,12 @@ class Router
|
|||
|
||||
$this->parameters = [];
|
||||
|
||||
$routeInfo = $dispatcher->dispatch($this->httpMethod, $cmd);
|
||||
$routeInfo = $dispatcher->dispatch($this->args->getMethod(), $cmd);
|
||||
if ($routeInfo[0] === Dispatcher::FOUND) {
|
||||
$moduleClass = $routeInfo[1];
|
||||
$this->parameters = $routeInfo[2];
|
||||
} elseif ($routeInfo[0] === Dispatcher::METHOD_NOT_ALLOWED) {
|
||||
if ($this->httpMethod === static::OPTIONS) {
|
||||
if ($this->args->getMethod() === static::OPTIONS) {
|
||||
// Default response for HTTP OPTIONS requests in case there is no special treatment
|
||||
$moduleClass = Options::class;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue