Closed ako-3004 closed 2 years ago
Hey @ako-3004 ,
good point... the headers are empty. Do you try to change this lines in the trait
$factory = new ServerRequestFactory();
$request = $factory->createServerRequest('GET', '/', []);
to this one:
$request = ServerRequestFactory::fromGlobals();
$request = $request->withMethod('GET')->withUri(new \TYPO3\CMS\Core\Http\Uri('/'));
Then the request should still be "GET /", but all the other internal information should be part of the request object.
Regards, Tim
Hi @lochmueller , that is the sollution for the problem. Thanks! Will you add this to your extension soon?
I created and used a copy of your trait in my extension, with the fixes above. Worked for me.
Hey @ako-3004 , Fixed in current main branch and will be part of the next release. Regards, Tim
As described on https://typo3blogger.de/ext-redirects-sprach-weiterleitungen/ I tried to use this trait to implement a language detection on using TYPO3 redirects.
Small changes had to be made to this code example, which are not difficult, but I fail on detecting users languages. Suspected in trait RespectLanguageLinkDetailsTrait using $response = $this->linkLanguageHandler->handle($request);
$request seems to miss the header information "Accept-Language de,en;q=0.7,af;q=0.3" what is confirmed requested by the Browser. This leads to DetectUserLanguagesEvent / LocaleCollection reporting user languages is empty.
Thanks, Alex