core icon indicating copy to clipboard operation
core copied to clipboard

[OpenApi] How to have multiple `Set-Cookie` header as PHP does not allow multiple same array key ?

Open Crovitche-1623 opened this issue 1 year ago • 2 comments

In RFC 6265, it's written that :

Origin servers SHOULD NOT fold multiple Set-Cookie header fields into a single header field.

I guess the only way of setting multiple cookie is separating them using a comma yet ?

How to reproduce

use ApiPlatform\OpenApi\Model\Operation;

$fooBarOperation = new Operation(
    // ...
    responses: [
        Response::HTTP_FOUND => [
             // ...
            'headers' => [
                'Set-Cookie' => [
                   // ...
                ],
                // Here I cannot declare another `Set-Cookie` array key
            ]
        ]
    ]
);

Crovitche-1623 avatar Sep 20 '24 13:09 Crovitche-1623

Related: https://github.com/OAI/OpenAPI-Specification/issues/1237

Crovitche-1623 avatar Sep 20 '24 13:09 Crovitche-1623

BTW, I wanted to decorate the login route to add multiple Set-Cookie header because I use the "Split JWT" mechanism provided by LexikJWTAuthenticationBundle.

Crovitche-1623 avatar Sep 20 '24 14:09 Crovitche-1623

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 22 '24 04:11 stale[bot]