mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Pass RX_REQUEST_URL directly to the Router
This commit is contained in:
parent
8964891387
commit
d5160c28ce
3 changed files with 3 additions and 10 deletions
|
|
@ -237,8 +237,7 @@ class Context
|
|||
if (in_array(self::$_instance->request_method, array('GET', 'POST', 'JSON')))
|
||||
{
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?: 'GET';
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
$route_info = Rhymix\Framework\Router::parseURL($method, $url, Rhymix\Framework\Router::getRewriteLevel());
|
||||
$route_info = Rhymix\Framework\Router::parseURL($method, RX_REQUEST_URL, Rhymix\Framework\Router::getRewriteLevel());
|
||||
self::setRequestArguments($route_info->args);
|
||||
self::$_route_info = $route_info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,12 +113,6 @@ class Router
|
|||
*/
|
||||
public static function parseURL(string $method, string $url, int $rewrite_level)
|
||||
{
|
||||
// Get the local part of the current URL.
|
||||
if (starts_with(\RX_BASEURL, $url))
|
||||
{
|
||||
$url = substr($url, strlen(\RX_BASEURL));
|
||||
}
|
||||
|
||||
// Prepare the return object.
|
||||
$result = new \stdClass;
|
||||
$result->status = 200;
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ class RouterTest extends \Codeception\TestCase\Test
|
|||
$args = array('mid' => 'board', 'document_srl' => '123');
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'board/123', 1)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'index.php?mid=board&document_srl=123', 0)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', \RX_BASEURL . 'board/123', 1)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', \RX_BASEURL . 'index.php?mid=board&document_srl=123', 0)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'board/123', 1)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'index.php?mid=board&document_srl=123', 0)->args);
|
||||
|
||||
$args = array('mid' => 'board', 'act' => 'dispBoardModifyComment', 'comment_srl' => '456', 'extra_param' => 'foo bar');
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->args);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue