diff --git a/lib/controllers/share.js b/lib/controllers/share.js index 1adb2d2..76b6ed8 100644 --- a/lib/controllers/share.js +++ b/lib/controllers/share.js @@ -250,7 +250,7 @@ export default function (_hostName, port, options) { } try { const content = await resolver(serviceOptions, id); - res.send(content); + res.set("Content-Type", "application/json").send(content); } catch (reason) { console.warn(JSON.stringify(reason.response, null, 2)); res diff --git a/spec/share-s3.spec.js b/spec/share-s3.spec.js index fad9f29..7088e2d 100644 --- a/spec/share-s3.spec.js +++ b/spec/share-s3.spec.js @@ -74,7 +74,7 @@ describe("Share Module (e2e) - S3", () => { await supertestReq(app) .get("/share/s3-aqJr26G16vOvgbBGgrfzSYLIcy") - .expect(200, Buffer.from(JSON.stringify({ data: "test content" }))); + .expect(200, { data: "test content" }); }); it('returns correct url in response when "newShareUrlPrefix" is empty string', async () => { @@ -104,7 +104,7 @@ describe("Share Module (e2e) - S3", () => { await supertestReq(app) .get("/share/hBp74ADLrPU6flu0qu07Kyi1FM0") - .expect(200, Buffer.from(JSON.stringify({ data: "test content empty" }))); + .expect(200, { data: "test content empty" }); }); it("should return 404 for non-existent share", async () => {