unprint 0.18.12 → 0.18.14
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 +17 -14
- package/tests/init.js +1 -1
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -736,7 +736,7 @@ function extractDate(dateString, format, customOptions) {
|
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
const options = {
|
|
739
|
-
match: /((\d{1,4}[/-]\d{1,2}[/-]\d{1,4})|(\w+\s+\d{1,2}
|
|
739
|
+
match: /((\d{1,4}[/-]\d{1,2}[/-]\d{1,4})|(\w+\s+\d{1,2}([a-z]{2})?,?\s+\d{4})|(\d{1,2}-\w+-\d{2,4}))((T|\s+)\d{1,2}:\d{2}(:\d{2})?)?/gi, // matches any of 01-01-1970, 1970-01-01, 01-Jan-70 and January 1, 1970 with optional 00:00[:00] time
|
|
740
740
|
matchIndex: 0,
|
|
741
741
|
timezone: 'UTC',
|
|
742
742
|
...customOptions,
|
|
@@ -1115,15 +1115,17 @@ function curateHeaders(headers, options) {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
1117
|
function curateCookies(headers) {
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1118
|
+
if (headers) {
|
|
1119
|
+
const setCookie = typeof headers.get === 'function'
|
|
1120
|
+
? headers.get('set-cookie')
|
|
1121
|
+
: headers['set-cookie'];
|
|
1121
1122
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1123
|
+
if (setCookie) {
|
|
1124
|
+
try {
|
|
1125
|
+
return cookie.parseCookie(setCookie);
|
|
1126
|
+
} catch (_error) {
|
|
1127
|
+
// invalid cookie
|
|
1128
|
+
}
|
|
1127
1129
|
}
|
|
1128
1130
|
}
|
|
1129
1131
|
|
|
@@ -1134,6 +1136,7 @@ function curateResponse(res, data, options, { url, control, customOptions }) {
|
|
|
1134
1136
|
const base = {
|
|
1135
1137
|
ok: true,
|
|
1136
1138
|
data,
|
|
1139
|
+
body: data,
|
|
1137
1140
|
status: res.statusCode || res.status,
|
|
1138
1141
|
statusText: res.statusText,
|
|
1139
1142
|
headers: res.headers,
|
|
@@ -1522,12 +1525,8 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1522
1525
|
return request(newUrl, body, options, method, redirects + 1);
|
|
1523
1526
|
}
|
|
1524
1527
|
|
|
1525
|
-
const data = options.interface === 'fetch'
|
|
1526
|
-
? await res.text()
|
|
1527
|
-
: await res.body.text();
|
|
1528
|
-
|
|
1529
1528
|
if (!(status >= 200 && status < 300)) {
|
|
1530
|
-
handleError(new Error(`HTTP response from ${url} not OK (${status} ${res.statusText})
|
|
1529
|
+
handleError(new Error(`HTTP response from ${url} not OK (${status} ${res.statusText})`), 'HTTP_NOT_OK');
|
|
1531
1530
|
|
|
1532
1531
|
events.emit('requestError', {
|
|
1533
1532
|
...feedbackBase,
|
|
@@ -1546,6 +1545,10 @@ async function request(url, body, customOptions = {}, method = 'GET', redirects
|
|
|
1546
1545
|
};
|
|
1547
1546
|
}
|
|
1548
1547
|
|
|
1548
|
+
const data = options.interface === 'fetch'
|
|
1549
|
+
? await res.text()
|
|
1550
|
+
: await res.body.text();
|
|
1551
|
+
|
|
1549
1552
|
events.emit('requestSuccess', {
|
|
1550
1553
|
...feedbackBase,
|
|
1551
1554
|
status,
|