Skip to content

Commit c1f3f33

Browse files
Jade-GGjasonvarga
andauthored
[5.x] Require url in nocache request (#12975)
Co-authored-by: Jason Varga <[email protected]>
1 parent b88ae3a commit c1f3f33

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/StaticCaching/NoCache/Controller.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class Controller
1010
{
1111
public function __invoke(Request $request, Session $session)
1212
{
13+
$request->validate(['url' => 'required|string']);
14+
1315
$url = $request->input('url');
1416

1517
if (config('statamic.static_caching.ignore_query_strings', false)) {

tests/StaticCaching/NocacheRouteTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,12 @@ public function index()
5353
],
5454
]);
5555
}
56+
57+
#[Test]
58+
public function url_is_required()
59+
{
60+
$this
61+
->postJson('/!/nocache')
62+
->assertJsonValidationErrorFor('url');
63+
}
5664
}

0 commit comments

Comments
 (0)