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

how to request.respond() multiple set-cookie headers? #5740

Closed
ghost opened this issue Apr 26, 2020 · 7 comments
Closed

how to request.respond() multiple set-cookie headers? #5740

ghost opened this issue Apr 26, 2020 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 26, 2020

If I look at the respond code int NetworkManager.js it only accepts a single 'set-cookie' header as a string.

  async respond(response) {
    /** @type {!Object<string, string>} */
    const responseHeaders = {};
    if (response.headers) {
      for (const header of Object.keys(response.headers))
        responseHeaders[header.toLowerCase()] = response.headers[header];
    }
    if (response.contentType)
      responseHeaders['content-type'] = response.contentType;
    if (responseBody && !('content-length' in responseHeaders))
      responseHeaders['content-length'] = String(Buffer.byteLength(responseBody));

I've tried

{headers: {'set-cookie': '1=1.;Domain=.site.com;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Priority=HIGH,2=2.;Domain=.site.com;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Secure;HttpOnly;Priority=HIGH;SameSite=none,3=3.;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Secure;HttpOnly;Priority=HIGH'}}

and

{headers: {'set-cookie': '1=1.;Domain=.site.com;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Priority=HIGH, 2=2.;Domain=.site.com;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Secure;HttpOnly;Priority=HIGH;SameSite=none, 3=3.;Path=/;Expires=Tue, 26-Apr-2022 10:30:53 GMT;Secure;HttpOnly;Priority=HIGH'}}

but neither set the cookies

If I mock request.respond and put the set-cookie each on their own header it works.

@Ganitzsh
Copy link

I have a similar issue, did you find a solution to this?

@ghost
Copy link
Author

ghost commented Sep 10, 2020

I have a similar issue, did you find a solution to this?

I think I mocked request.respond with my own implementation. it's been a while, don't have the code anymore.

@onlyil
Copy link

onlyil commented May 8, 2021

I have a similar issue, did you find a solution to this?

@dukei
Copy link

dukei commented Sep 17, 2021

Any progress on this issue? It is still not possible to pass multiple set-cookie headers to request.respond().

@Junyan
Copy link
Contributor

Junyan commented May 4, 2022

@dukei @onlyil @dukei The issue is solved, see v13.6.0.

@stale
Copy link

stale bot commented Jul 3, 2022

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

@stale stale bot added the unconfirmed label Jul 3, 2022
@stale
Copy link

stale bot commented Aug 2, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

@stale stale bot closed this as completed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants