Skip to content

Commit

Permalink
chore(http): add test showing HttpBody<any> works
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Oct 4, 2023
1 parent 9db146a commit 24d7c9c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/http/tests/router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>): 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' });
});

0 comments on commit 24d7c9c

Please sign in to comment.