From: Lucas Di Pentima Date: Tue, 21 Jan 2020 15:06:00 +0000 (-0300) Subject: 15672: Adds test for params being just under the limit of needing POST. X-Git-Tag: 2.0.0~15^2~1 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/ea35db0fe5387ed9cca2f8a8fabeaea10f89de67 15672: Adds test for params being just under the limit of needing POST. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/services/common-service/common-resource-service.test.ts b/src/services/common-service/common-resource-service.test.ts index 943325b7..2a18ce23 100644 --- a/src/services/common-service/common-resource-service.test.ts +++ b/src/services/common-service/common-resource-service.test.ts @@ -124,4 +124,16 @@ describe("CommonResourceService", () => { expect(axiosMock.history.post[0].data.get('filters')).toBe(`[${tooBig}]`); expect(axiosMock.history.post[0].params._method).toBe('GET'); }); + + it("#list using GET when query string is not too big", async () => { + axiosMock + .onAny("/resource") + .reply(200); + const notTooBig = 'x'.repeat(1480); + const commonResourceService = new CommonResourceService(axiosInstance, "resource", actions); + await commonResourceService.list({ filters: notTooBig }); + expect(axiosMock.history.post.length).toBe(0); + expect(axiosMock.history.get.length).toBe(1); + expect(axiosMock.history.get[0].params.filters).toBe(`[${notTooBig}]`); + }); });