unprint 0.18.9 → 0.18.11
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.
- package/package.json +1 -1
- package/src/app.js +20 -0
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -1114,6 +1114,22 @@ function curateHeaders(headers, options) {
|
|
|
1114
1114
|
return headers;
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
|
+
function curateCookies(headers) {
|
|
1118
|
+
const setCookie = typeof headers.get === 'function'
|
|
1119
|
+
? headers.get('set-cookie')
|
|
1120
|
+
: headers['set-cookie'];
|
|
1121
|
+
|
|
1122
|
+
if (setCookie) {
|
|
1123
|
+
try {
|
|
1124
|
+
return cookie.parseCookie(setCookie);
|
|
1125
|
+
} catch (_error) {
|
|
1126
|
+
// invalid cookie
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1117
1133
|
function curateResponse(res, data, options, { url, control, customOptions }) {
|
|
1118
1134
|
const base = {
|
|
1119
1135
|
ok: true,
|
|
@@ -1121,6 +1137,7 @@ function curateResponse(res, data, options, { url, control, customOptions }) {
|
|
|
1121
1137
|
status: res.statusCode || res.status,
|
|
1122
1138
|
statusText: res.statusText,
|
|
1123
1139
|
headers: res.headers,
|
|
1140
|
+
cookies: curateCookies(res.headers),
|
|
1124
1141
|
response: res,
|
|
1125
1142
|
res,
|
|
1126
1143
|
control,
|
|
@@ -1355,6 +1372,7 @@ async function browserRequest(url, customOptions = {}) {
|
|
|
1355
1372
|
status,
|
|
1356
1373
|
statusText,
|
|
1357
1374
|
headers,
|
|
1375
|
+
cookies: curateCookies(headers),
|
|
1358
1376
|
response: res,
|
|
1359
1377
|
res,
|
|
1360
1378
|
};
|
|
@@ -1380,6 +1398,7 @@ async function browserRequest(url, customOptions = {}) {
|
|
|
1380
1398
|
status,
|
|
1381
1399
|
statusText,
|
|
1382
1400
|
headers,
|
|
1401
|
+
cookies: curateCookies(headers),
|
|
1383
1402
|
response: res,
|
|
1384
1403
|
res,
|
|
1385
1404
|
};
|
|
@@ -1521,6 +1540,7 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1521
1540
|
status,
|
|
1522
1541
|
statusText: res.statusText,
|
|
1523
1542
|
headers: res.headers,
|
|
1543
|
+
cookies: curateCookies(res.headers),
|
|
1524
1544
|
response: res,
|
|
1525
1545
|
res,
|
|
1526
1546
|
};
|