Skip to content

[3.1] Regression in stateless firewall, session is initialized #18951

Closed
@romainneutron

Description

@romainneutron

I have a stateless API endpoint:

security:
    firewalls:
        api:
            pattern:  ^/api/
            stateless: true
            anonymous: true
            http_basic:
                realm: "API Hello"
                provider: api_provider

When I do calls on this API, everything work as expected, no cookies.
But when testing, this fails:

There was 1 failure:

1) AppBundle\Tests\Controller\Api\AuthenticationTest::testApiNoCookie
API should not set any cookie!
Failed asserting that actual size 1 matches expected size 0.
    public function testApiNoCookie()
    {
        $this->client->request('GET', '/api/');

        $this->assertResponseStatus(Response::HTTP_OK);
        $this->assertCount(0, $this->client->getResponse()->headers->getCookies(), 'API should not set any cookie!');
    }

The issue does not exist in 3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions