Skip to content

Commit 9f41fe6

Browse files
committed
Replace / endpoint with fallback
1 parent dd0c794 commit 9f41fe6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
|
2727
*/
2828

29-
Route::get('/', function (Request $request) {
29+
Route::fallback(function (Request $request) {
3030
$shop = Utils::sanitizeShopDomain($request->query('shop'));
3131
$host = $request->query('host');
3232
$appInstalled = Session::where('shop', $shop)->exists();

tests/Feature/RootTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,20 @@ public function testReturn200IfShopIsAlreadyInstalled()
3333
$response->assertStatus(200);
3434
$response->assertViewIs('react');
3535
}
36+
37+
public function testUncaughtRequestsTriggerRouteBehaviour()
38+
{
39+
$session = new Session(
40+
"test-session-id",
41+
"test-shop.myshopify.io",
42+
false,
43+
"test-session-state"
44+
);
45+
46+
Context::$SESSION_STORAGE->storeSession($session);
47+
48+
$response = $this->get("/not-a-real-endpoint?shop=test-shop.myshopify.io");
49+
$response->assertStatus(200);
50+
$response->assertViewIs('react');
51+
}
3652
}

0 commit comments

Comments
 (0)