protected function createRequest(string $verb, string $route, $body = [], $headers = [])
    {
        $url = Router::getRouteUrl($route);

        if (strtoupper($verb) === 'GET') {
            $url .= '?' . http_build_query($body);
        }

        $request = new Request($verb, $url, $this->mergeDefaultHeaders($headers), json_encode($body));

        $this->setRequest($request);

        return $request;
    }
protected function createRequest(string $verb, string $route, $body = [], $headers = [])
    {
        $url = Router::getRouteUrl($route);

        if (strtoupper($verb) === 'GET') {
            $url .= '?' . http_build_query($body);
        }

        $request = new Request($verb, $url, $this->mergeDefaultHeaders($headers), json_encode($body));

        $this->setRequest($request);

        return $request;
    }
protected function createRequest ( string $ verb , string $ route , $ body = [ ] , $ headers = [ ] ) { $ url = Router :: getRouteUrl ( $ route ) ; if ( strtoupper ( $ verb ) === 'GET' ) { $ url .= '?' . http_build_query ( $ body ) ; } $ request = new Request ( $ verb , $ url , $ this -> mergeDefaultHeaders ( $ headers ) , json_encode ( $ body ) ) ; $ this -> setRequest ( $ request ) ; return $ request ; }
Creates and sets the request instance

@param string $verb
@param string $route
@param array $body
@param array $headers
@return Request
Creates and sets the request instance