Skip to content

Commit

Permalink
fix encoded URL
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBoes committed Sep 25, 2024
1 parent ddf47e9 commit a1ee60f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function toResponse($request)
$page = [
'component' => $this->component,
'props' => $props,
'url' => Str::start(Str::after($request->fullUrl(), $request->getSchemeAndHttpHost()), '/'),
'url' => Str::start(Str::after(rawurldecode($request->fullUrl()), $request->getSchemeAndHttpHost()), '/'),
'version' => $this->version,
];

Expand Down
12 changes: 12 additions & 0 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,18 @@ public function test_the_page_url_doesnt_double_up(): void
$this->assertSame('/subpath/product/123', $page->url);
}

public function test_the_page_url_is_not_encoded(): void
{
$request = Request::create('/product/123', 'GET', ['value' => 'te/st']);
$request->headers->add(['X-Inertia' => 'true']);

$response = new Response('Product/Show', []);
$response = $response->toResponse($request);
$page = $response->getData();

$this->assertSame('/product/123?value=te/st', $page->url);
}

public function test_prop_as_basic_array(): void
{
$request = Request::create('/years', 'GET');
Expand Down

0 comments on commit a1ee60f

Please sign in to comment.