Skip to content

Commit

Permalink
Merge pull request #11 from visuellverstehen/10-fix-empty-header
Browse files Browse the repository at this point in the history
fix: do nothing, if HTTP accept language header is not set, refs #10
  • Loading branch information
malteriechmann committed Apr 11, 2023
2 parents f0c6bf0 + 7c60f0a commit 75432cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Middleware/LanguageRedirectionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ class LanguageRedirectionMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Do nothing, if a HTTP referer is set
// Do nothing, if HTTP referer header is set
if (! empty($request->getServerParams()['HTTP_REFERER'])) {
return $handler->handle($request);
}

// Do nothing, if HTTP accept language header is not set
if (empty($request->getServerParams()['HTTP_ACCEPT_LANGUAGE'])) {
return $handler->handle($request);
}

// Get the website's configured site languages
$siteLanguages = $request->getAttribute('site')->getLanguages();

Expand Down

0 comments on commit 75432cd

Please sign in to comment.