diff --git a/library/think/Request.php b/library/think/Request.php index 75f2b9ef..d9286298 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -210,6 +210,8 @@ class Request unset($server['HTTPS']); $server['SERVER_PORT'] = 80; } + } else { + $info['scheme'] = 'http'; } if (isset($info['port'])) { $server['SERVER_PORT'] = $info['port']; diff --git a/tests/thinkphp/library/think/requestTest.php b/tests/thinkphp/library/think/requestTest.php index 837aa839..1b5afa34 100644 --- a/tests/thinkphp/library/think/requestTest.php +++ b/tests/thinkphp/library/think/requestTest.php @@ -130,7 +130,7 @@ class requestTest extends \PHPUnit_Framework_TestCase public function testVar() { Config::set('app_multi_module', true); - $request = new Request(); + $request = Request::create(''); $request->route(['name' => 'thinkphp', 'id' => 6]); $request->get(['id' => 10]); $request->post(['id' => 8]); diff --git a/tests/thinkphp/library/think/urlTest.php b/tests/thinkphp/library/think/urlTest.php index ef49b89f..ced519d7 100644 --- a/tests/thinkphp/library/think/urlTest.php +++ b/tests/thinkphp/library/think/urlTest.php @@ -74,7 +74,7 @@ class urlTest extends \PHPUnit_Framework_TestCase public function testBuildMethod() { Route::get('blog/:id', '\app\index\controller\blog@read'); - $this->assertEquals('/blog/10.html', Url::build('[\app\index\controller\blog@read]', 'id=10', 'html')); + $this->assertEquals('/blog/10.html', Url::build('\app\index\controller\blog@read', 'id=10', 'html')); } public function testBuildRoute() @@ -97,10 +97,10 @@ class urlTest extends \PHPUnit_Framework_TestCase { Route::get('blog/:id', 'index/blog'); Config::set('url_html_suffix', 'shtml'); - $this->assertEquals('/blog/10.shtml#detail', Url::build('/blog/10#detail')); + $this->assertEquals('/blog/10.shtml#detail', Url::build('index/blog#detail', 'id=10')); Config::set('url_common_param', true); - $this->assertEquals('/blog/10.shtml?foo=bar#detail', Url::build('/blog/10#detail', "foo=bar")); + $this->assertEquals('/blog/10.shtml?foo=bar#detail', Url::build('index/blog#detail', "id=10&foo=bar")); } public function testBuildDomain()