From 5e3c202a9adeef31a0a7e7ee0cbee3bcbb1262f1 Mon Sep 17 00:00:00 2001 From: Guillaume Lepoetre Date: Thu, 31 Oct 2024 11:24:47 +0100 Subject: [PATCH 1/2] Add body on cloudsync-mock --- .../cloudsync-mock/src/lib/collector-api.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/e2e-env/cloudsync-mock/src/lib/collector-api.ts b/e2e-env/cloudsync-mock/src/lib/collector-api.ts index 37833eb5..85ca00e0 100644 --- a/e2e-env/cloudsync-mock/src/lib/collector-api.ts +++ b/e2e-env/cloudsync-mock/src/lib/collector-api.ts @@ -1,26 +1,27 @@ import { Server } from "./server"; -import {WsServer} from "./ws-server"; +import { WsServer } from "./ws-server"; // @ts-expect-error we don't care about packaging here import multer from "multer"; -const storage = multer.memoryStorage() -const upload = multer({ storage }) +const storage = multer.memoryStorage(); +const upload = multer({ storage }); export class CollectorApiServer extends Server { - public constructor( probe: WsServer) { - super( probe); + public constructor(probe: WsServer) { + super(probe); this.api.get("/", (_req, res) => { res.status(200).end(); }); - this.api.post("/upload/:jobid", upload.single('file'), (req, res) => { + this.api.post("/upload/:jobid", upload.single("file"), (req, res) => { const jobId = req.params.jobid; if (jobId.startsWith("valid-job-")) { - req.body.file = req.file.buffer.toString() - .split('\n') - .map(line => JSON.parse(line.trim())) - res.status(201).end(); + req.body.file = req.file.buffer + .toString() + .split("\n") + .map((line) => JSON.parse(line.trim())); + res.send({ status: "success" }).status(201).end(); } else { res.status(500).end(); } From 1e4ab5915727dd0cad7bec88a056bcaf3f67706e Mon Sep 17 00:00:00 2001 From: Guillaume Lepoetre Date: Thu, 31 Oct 2024 15:00:45 +0100 Subject: [PATCH 2/2] Revert collector --- e2e-env/cloudsync-mock/src/lib/collector-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-env/cloudsync-mock/src/lib/collector-api.ts b/e2e-env/cloudsync-mock/src/lib/collector-api.ts index 85ca00e0..842d8b7d 100644 --- a/e2e-env/cloudsync-mock/src/lib/collector-api.ts +++ b/e2e-env/cloudsync-mock/src/lib/collector-api.ts @@ -21,7 +21,7 @@ export class CollectorApiServer extends Server { .toString() .split("\n") .map((line) => JSON.parse(line.trim())); - res.send({ status: "success" }).status(201).end(); + res.status(201).end(); } else { res.status(500).end(); }