@ezs/basics 2.7.0 → 2.7.2
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/lib/url-connect.js +9 -1
- package/package.json +3 -3
package/lib/url-connect.js
CHANGED
|
@@ -88,7 +88,15 @@ async function URLConnect(data, feed) {
|
|
|
88
88
|
}
|
|
89
89
|
if (json) {
|
|
90
90
|
const bodyOutRaw = await (0, _getStream.default)(response.body);
|
|
91
|
-
|
|
91
|
+
if (bodyOutRaw === '') {
|
|
92
|
+
throw new Error('URL returned an empty response');
|
|
93
|
+
}
|
|
94
|
+
let bodyOutArray;
|
|
95
|
+
try {
|
|
96
|
+
bodyOutArray = JSON.parse(bodyOutRaw);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
throw new Error(`URL returned an invalid JSON response (${bodyOutRaw})`);
|
|
99
|
+
}
|
|
92
100
|
return (0, _from.default)(bodyOutArray).pipe(output);
|
|
93
101
|
}
|
|
94
102
|
return response.body.pipe(output);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezs/basics",
|
|
3
3
|
"description": "Basics statements for EZS",
|
|
4
|
-
"version": "2.7.
|
|
4
|
+
"version": "2.7.2",
|
|
5
5
|
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Inist-CNRS/ezs/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"inflection": "2.0.1",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
21
|
"make-dir": "4.0.0",
|
|
22
|
-
"micromatch": "4.0.
|
|
22
|
+
"micromatch": "4.0.8",
|
|
23
23
|
"node-abort-controller": "1.1.0",
|
|
24
24
|
"parse-headers": "2.0.4",
|
|
25
25
|
"path-exists": "4.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"directories": {
|
|
37
37
|
"test": "test"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e50976d81c3ced9e9f0dbfbb147fa7ed49f9da3c",
|
|
40
40
|
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
41
41
|
"keywords": [
|
|
42
42
|
"ezs"
|