Issue Bug Closed

#101001Ease hard type check on custom HTTP headers

Adrian Rudnik 06/12/23, 13:30 updated 07/09/24, 14:15

Description

Just had to debug why my custom header did not end up in response.

<?php

namespace MyClient\MyExt\Controller;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\JsonResponse;

class DemoController extends AbstractController
{
    public function ajaxAction(): ResponseInterface
    {
        return new JsonResponse([], 200, ['X-Page' => 123]);
    }
}

The header will be skipped due to hard checks on the correct type and does not throw any notice in `\TYPO3\CMS\Core\Http\Message::filterHeaders`.

It would be nice to:

- get a notice thrown on invalid headers, easing the developer experience
- allow header values to go through https://www.php.net/manual/de/function.strval.php, therefore allowing any string representation of a given value and the support for classes that implement https://www.php.net/manual/de/class.stringable.php.

Reviews 3

History 28

  1. Gerrit Code Review pushed patch set 1 for main to change 79589 status New Under Review 07/03/23, 11:41

  2. Gerrit Code Review pushed patch set 2 for main to change 79589 07/03/23, 13:05

  3. Gerrit Code Review pushed patch set 3 for main to change 79589 07/03/23, 14:29

  4. Gerrit Code Review pushed patch set 4 for main to change 79589 07/05/23, 21:09

  5. Gerrit Code Review pushed patch set 1 for 12.4 to change 79780 07/06/23, 04:09

  6. Gerrit Code Review pushed patch set 1 for 11.5 to change 79781 07/06/23, 04:09

  7. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 07/06/23, 04:10

    Applied in changeset commit:d295723f5502cecd9864ea2f5957e70497a2957a.

  8. Benni Mack changed status Resolved Closed 07/09/24, 14:15