@moreapp/common-nodejs 0.7.2 → 0.7.3
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/dist/MoreAppClient.js
CHANGED
|
@@ -49,5 +49,6 @@ class MoreAppClient {
|
|
|
49
49
|
exports.default = MoreAppClient;
|
|
50
50
|
function getFilename(res) {
|
|
51
51
|
const contentDispositionHeader = res.headers["content-disposition"];
|
|
52
|
-
|
|
52
|
+
const filename = (0, content_disposition_parser_1.default)(contentDispositionHeader)?.filename;
|
|
53
|
+
return filename ? decodeURI(filename) : undefined;
|
|
53
54
|
}
|
|
@@ -13,7 +13,7 @@ test("download binary file", async () => {
|
|
|
13
13
|
.matchHeader("x-more-seal", "my-seal")
|
|
14
14
|
.reply(200, file, {
|
|
15
15
|
"Content-Type": "image/jpg",
|
|
16
|
-
"content-disposition": 'attachment; filename="my
|
|
16
|
+
"content-disposition": 'attachment; filename="my%20photo.jpg"',
|
|
17
17
|
});
|
|
18
18
|
const client = new MoreAppClient_1.default({
|
|
19
19
|
serviceName: "Common Test",
|
|
@@ -23,7 +23,7 @@ test("download binary file", async () => {
|
|
|
23
23
|
const binaryFile = await client.getBinary("/download");
|
|
24
24
|
expect(binaryFile.buffer).toStrictEqual(file);
|
|
25
25
|
expect(binaryFile.contentType).toBe("image/jpg");
|
|
26
|
-
expect(binaryFile.filename).toBe("my
|
|
26
|
+
expect(binaryFile.filename).toBe("my photo.jpg");
|
|
27
27
|
apiMock.done();
|
|
28
28
|
});
|
|
29
29
|
test("404", async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moreapp/common-nodejs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.1",
|
|
39
|
-
"@types/node": "18.16.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
41
|
-
"@typescript-eslint/parser": "5.59.
|
|
42
|
-
"eslint": "8.
|
|
39
|
+
"@types/node": "18.16.9",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.59.5",
|
|
41
|
+
"@typescript-eslint/parser": "5.59.5",
|
|
42
|
+
"eslint": "8.40.0",
|
|
43
43
|
"eslint-config-airbnb-typescript": "17.0.0",
|
|
44
44
|
"eslint-config-prettier": "8.8.0",
|
|
45
45
|
"eslint-plugin-import": "2.27.5",
|