Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  explicitly mark nullable parameters as nullable
  fix low deps tests
  [HttpKernel] Fix datacollector caster for reference object property
  bug #51578 [Cache] always select database for persistent redis connections
  [Security] Validate that CSRF token in form login is string similar to username/password
  [validator] validated Dutch translation
  Improve dutch translations
  [Translation] Skip state=needs-translation entries only when source == target
  [HttpKernel] Ensure controllers are not lazy
  [Validator] Fill in trans-unit id 113: This URL does not contain a TLD.
  [Validator] added missing Polish translation for unit 113
  [Validator] add missing lv translation
  [HttpClient] Let curl handle transfer encoding
  [Messenger] Make Doctrine connection ignore unrelated tables on setup
  [HttpFoundation] Set content-type header in RedirectResponse
  add translations for the requireTld constraint option message
  [Serializer] Fix unexpected allowed attributes
  [FrameworkBundle] Fix registration of the bundle path to translation
  • Loading branch information
xabbuh committed Apr 12, 2024
2 parents ebc713b + 3c8deb7 commit 2932365
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function setTargetUrl(string $url): static
</html>', htmlspecialchars($url, \ENT_QUOTES, 'UTF-8')));

$this->headers->set('Location', $url);
$this->headers->set('Content-Type', 'text/html; charset=utf-8');

return $this;
}
Expand Down
7 changes: 7 additions & 0 deletions Tests/RedirectResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public function testGenerateLocationHeader()
$this->assertEquals('foo.bar', $response->headers->get('Location'));
}

public function testGenerateContentTypeHeader()
{
$response = new RedirectResponse('foo.bar');

$this->assertSame('text/html; charset=utf-8', $response->headers->get('Content-Type'));
}

public function testGetTargetUrl()
{
$response = new RedirectResponse('foo.bar');
Expand Down

0 comments on commit 2932365

Please sign in to comment.