diff --git a/src/functions/list/__tests__/create.test.js b/src/functions/list/__tests__/create.test.js index 7da4f7a..5d956aa 100644 --- a/src/functions/list/__tests__/create.test.js +++ b/src/functions/list/__tests__/create.test.js @@ -13,8 +13,8 @@ describe("CREATE List", () => { expect(response).toStrictEqual({ statusCode: 400, - headers: { "Content-Type": "text/plain" }, - body: "Invalid request. Missing body params.", + headers: { "Content-Type": "application/json" }, + body: '{"issues":[{"code":"invalid_type","expected":"object","received":"null","path":[],"message":"Expected object, received null"}],"name":"ZodError"}', }); }); diff --git a/src/functions/list/create.ts b/src/functions/list/create.ts index 0e64afc..12a78f3 100644 --- a/src/functions/list/create.ts +++ b/src/functions/list/create.ts @@ -5,14 +5,9 @@ import { APIGatewayProxyEventV2, Handler } from "aws-lambda"; import { z } from "zod"; import { List } from "../../models/table"; -import { HttpError } from "../../utils/httpError"; import { ValidationError } from "../../utils/validationError"; const createListHandler: Handler = async (event) => { - if (!event.body) { - throw new HttpError(400, "Invalid request. Missing body params."); - } - const listSchema = z.object({ userId: z.string(), name: z.string(),