Esempio n. 1
0
 /**
  * Handles the POST requests
  *
  * @param null|string $version
  * @param null|string $service
  * @param null|string $resource
  *
  * @return null|ServiceResponseInterface
  */
 public function handlePOST($version = null, $service = null, $resource = null)
 {
     // Check for the various method override headers or query params
     $xMethod = Request::header('X-HTTP-Method', Request::header('X-HTTP-Method-Override', Request::header('X-Method-Override', Request::query('method'))));
     if (!empty($xMethod)) {
         if (!in_array($xMethod, Verbs::getDefinedConstants())) {
             throw new MethodNotAllowedHttpException("Invalid verb tunneling with " . $xMethod);
         }
         Request::setMethod($xMethod);
     }
     return $this->handleService($version, $service, $resource);
 }
Esempio n. 2
0
 /**
  * Sets the HTTP Action verb
  *
  * @param $action string
  *
  * @return $this
  */
 protected function setAction($action)
 {
     $this->action = trim(strtoupper($action));
     //	Check verb aliases, set correct action allowing for closures
     if (null !== ($alias = ArrayUtils::get($this->verbAliases, $this->action))) {
         //	A closure?
         if (in_array($alias, Verbs::getDefinedConstants()) || !is_callable($alias)) {
             //	Set original and work with alias
             $this->originalAction = $this->action;
             $this->action = $alias;
         }
     }
     return $this;
 }