Skip to content

Conversation

@kenjis
Copy link
Member

@kenjis kenjis commented Oct 3, 2022

Description
See #5344

IncomingRequest::$uri will be protected.

  • fix incorrect assertions c42b1bf
  • refactor

Confirm the output of uri_string()

diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 0bfdce972..8650842af 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -35,7 +35,7 @@ $routes->set404Override();
 
 // We get a performance increase by specifying the default
 // route since we don't have to scan directories.
-$routes->get('/', 'Home::index');
+$routes->get('assets/(:any)', 'Home::index');
 
 /*
  * --------------------------------------------------------------------
diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php
index 7f867e95f..b8cd3af74 100644
--- a/app/Controllers/Home.php
+++ b/app/Controllers/Home.php
@@ -6,6 +6,6 @@ class Home extends BaseController
 {
     public function index()
     {
-        return view('welcome_message');
+        dd(uri_string());
     }
 }

Navigate to http://localhost:8080/assets/image.jpg
You will see:

uri_string() string (16) "assets/image.jpg"

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the testing Pull requests that changes tests only label Oct 3, 2022
@kenjis kenjis merged commit 16e2920 into codeigniter4:develop Oct 4, 2022
@kenjis kenjis deleted the refactor-remove-request-uri branch October 4, 2022 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Pull requests that changes tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants