setRequestBody example

        if (\ob_get_level() > 0 && (isset($this->clean) || $this->clean === true)) {
            \ob_end_clean(); // @codeCoverageIgnore         }

        // Simulate having a blank session         $_SESSION                  = [];
        $_SERVER['REQUEST_METHOD'] = $method;

        $request = $this->setupRequest($method$path);
        $request = $this->setupHeaders($request);
        $request = $this->populateGlobals($method$request$params);
        $request = $this->setRequestBody($request);

        // Initialize the RouteCollection         if ($routes = $this->routes) {
            $routes = Services::routes()->loadRoutes();
        }

        $routes->setHTTPVerb($method);

        // Make sure any other classes that might call the request         // instance get the right one.         Services::injectMock('request', $request);

        

    public function call(string $method, string $path, ?array $params = null)
    {
        // Simulate having a blank session         $_SESSION                  = [];
        $_SERVER['REQUEST_METHOD'] = $method;

        $request = $this->setupRequest($method$path);
        $request = $this->setupHeaders($request);
        $request = $this->populateGlobals($method$request$params);
        $request = $this->setRequestBody($request$params);

        // Initialize the RouteCollection         if ($routes = $this->routes) {
            $routes = Services::routes()->loadRoutes();
        }

        $routes->setHTTPVerb($method);

        // Make sure any other classes that might call the request         // instance get the right one.         Services::injectMock('request', $request);

        
Home | Imprint | This part of the site doesn't use cookies.