Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking header set-cookie issue #1532

Closed
marekjaskot opened this issue Jul 7, 2022 · 3 comments · Fixed by #1598
Closed

Mocking header set-cookie issue #1532

marekjaskot opened this issue Jul 7, 2022 · 3 comments · Fixed by #1598
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@marekjaskot
Copy link

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'
  },

@mcollina mcollina added bug Something isn't working enhancement New feature or request good first issue Good for newcomers labels Jul 7, 2022
@mcollina
Copy link
Member

mcollina commented Jul 7, 2022

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@jodevsa
Copy link
Contributor

jodevsa commented Jul 14, 2022

Hi, i would like to work on this if @marekjaskot isn't interested

@mcollina
Copy link
Member

go for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants