From 24d7c9c52c8e27047f38efc51f62ac6d2cd6d194 Mon Sep 17 00:00:00 2001 From: "Marc J. Schmidt" Date: Wed, 4 Oct 2023 14:35:57 +0200 Subject: [PATCH] chore(http): add test showing HttpBody works --- packages/http/tests/router.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/http/tests/router.spec.ts b/packages/http/tests/router.spec.ts index df7983e02..27e7115aa 100644 --- a/packages/http/tests/router.spec.ts +++ b/packages/http/tests/router.spec.ts @@ -1399,3 +1399,17 @@ test('upload security', async () => { } ]))).json).toMatchObject({ uploadedSize: 19 }); }); + +test('any http body', async () => { + class Controller { + @http.PUT('/test') + upload(body: HttpBody): any { + return { test: body.test }; + } + } + + const httpKernel = createHttpKernel([Controller]); + + const response = await httpKernel.request(HttpRequest.PUT('/test').json({ test: 'test' })); + expect(response.json).toMatchObject({ test: 'test' }); +});