Skip to content

Mocking header set-cookie issue #1532

@marekjaskot

Description

@marekjaskot

Hi,
There is a issue with mocking header set-cookie and when i try mocking multiple set-cookie

Example: When i mock request

mockAgent.get(accountFrontHost).intercept({
            path: '/user/login',
            method: 'POST',
            body: JSON.stringify(expectedPostUserLoginBody),
            query: expectedPostUserLoginParams,
            headers: {'Accept-Version': '1.0.0', 'Content-Type': 'application/json'}
        }).reply(204, {},{
            headers: {
                'set-cookie': [
                    'aaaaaaaa=bbbbbbbbbbbbbbbbbb; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure; SameSite=None',
                    'cccccccc=dddddddddddddddddd; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure',
                    'eeeeeeeeeee=ffffffffffffffff; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure; SameSite=None'
                ]
        }});

Mock "flattens" the set-cookie and reply as string not as array of strings

statusCode: 204,
  headers: {
    'set-cookie': 'aaaaaaaa=bbbbbbbbbbbbbbbbbb; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure; SameSite=None,cccccccc=dddddddddddddddddd; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure,eeeeeeeeeee=ffffffffffffffff; Domain=.example.pl; Path=/; Expires=Fri, 07 Jul 2023 10:04:22 GMT; HttpOnly; Secure; SameSite=None'
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions