/** * Test get URL */ public function testGetUrlWithHttps() { $env = \Slim\Environment::mock(array('HTTP_HOST' => 'slimframework.com', 'SERVER_NAME' => 'slim', 'SERVER_PORT' => 443, 'slim.url_scheme' => 'https')); $req = new \Slim\Http\Request($env); $this->assertEquals('https://slimframework.com', $req->getUrl()); }
/** * Reconstructs a full URL for the request from Slim's request object. * * @param Slim\Environment $env The application environment. * @param Slim\Http\Request $request * @return string The request URL. */ private function request_url($env, $request) { $url = implode('', array($request->getUrl(), $request->getRootUri(), $request->getPathInfo())); if (isset($env['QUERY_STRING']) and !empty($env['QUERY_STRING'])) { $url .= '?' . $env['QUERY_STRING']; } return $url; }