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

avoid passing the saved cookies everytime the page get requested #1

Open
unixfox opened this issue May 23, 2020 · 2 comments
Open

avoid passing the saved cookies everytime the page get requested #1

unixfox opened this issue May 23, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@unixfox
Copy link
Owner

unixfox commented May 23, 2020

Mimic the normal behavior by passing set-cookie once.
Code that I used but needs to be tweaked so that the cookies doesn't contain secure, expires, domain:

Object.keys(responseHeaders).forEach(header => {
  const splitMultipleHeaders = responseHeaders[header].split("\n");
  if (splitMultipleHeaders.length > 1)
     ctx.set(header, splitMultipleHeaders);
  else
     ctx.set(header, jsesc(responseHeaders[header]));
});
@unixfox unixfox added the enhancement New feature or request label May 23, 2020
@unixfox unixfox self-assigned this May 23, 2020
Repository owner deleted a comment from rakeshbhai0091 Jan 22, 2023
@KHALIK786K
Copy link

Object.keys(responseHeaders).forEach(header => {
const splitMultipleHeaders = responseHeaders[header].split("\n");
if (splitMultipleHeaders.length > 1) {
const filteredHeaders = splitMultipleHeaders.map(headerValue => {
return headerValue.replace(/; Secure|; Expires=[^;]|; Domain=[^;]/g, '');
});
ctx.set(header, filteredHeaders);
} else {
const filteredHeader = responseHeaders[header].replace(/; Secure|; Expires=[^;]|; Domain=[^;]/g, '');
ctx.set(header, jsesc(filteredHeader));
}
});

@unixfox
Copy link
Owner Author

unixfox commented Apr 17, 2024

please create a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants