wirejs-scripts 3.0.164 → 3.0.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin.js +12 -0
  2. package/package.json +2 -2
package/bin.js CHANGED
@@ -290,6 +290,7 @@ async function handleApiResponse(context, res) {
290
290
  if (cookie.maxAge) cookieOptions.push(`Max-Age=${cookie.maxAge}`);
291
291
  if (cookie.httpOnly) cookieOptions.push('HttpOnly');
292
292
  if (cookie.secure) cookieOptions.push('Secure');
293
+ if (cookie.path) cookieOptions.push(`Path=${cookie.path}`);
293
294
 
294
295
  logger.info('setting cookie', cookie.name, cookie.value, cookieOptions);
295
296
  res.appendHeader(
@@ -473,6 +474,17 @@ function setResponseDetailsFromContext(context, res) {
473
474
  for (const [k, v] of Object.entries(context.responseHeaders)) {
474
475
  res.setHeader(k, v);
475
476
  }
477
+ for (const cookie of context.cookies.getSetCookies()) {
478
+ const cookieOptions = [];
479
+ if (cookie.maxAge) cookieOptions.push(`Max-Age=${cookie.maxAge}`);
480
+ if (cookie.httpOnly) cookieOptions.push('HttpOnly');
481
+ if (cookie.secure) cookieOptions.push('Secure');
482
+ if (cookie.path) cookieOptions.push(`Path=${cookie.path}`);
483
+ const cookieStr = cookieOptions.length > 0
484
+ ? `${cookie.name}=${cookie.value}; ${cookieOptions.join('; ')}`
485
+ : `${cookie.name}=${cookie.value}`;
486
+ res.appendHeader('Set-Cookie', cookieStr);
487
+ }
476
488
  if (context.locationIsDirty) {
477
489
  res.setHeader('Location', context.location.href);
478
490
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-scripts",
3
- "version": "3.0.164",
3
+ "version": "3.0.166",
4
4
  "description": "Basic build and start commands for wirejs apps",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,6 +37,6 @@
37
37
  "style-loader": "^2.0.0",
38
38
  "webpack": "^5.97.1",
39
39
  "wirejs-dom": "^1.0.44",
40
- "wirejs-resources": "^0.1.166"
40
+ "wirejs-resources": "^0.1.168"
41
41
  }
42
42
  }