X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1e4630ddb8015d72978aae1be334cce2f8ca20d4..d2a55e74eadd28effb16f60d8d9cbe9bbedef14c:/lib/controller/router/router_test.go diff --git a/lib/controller/router/router_test.go b/lib/controller/router/router_test.go index 18fff7c9cc..639d2a28b4 100644 --- a/lib/controller/router/router_test.go +++ b/lib/controller/router/router_test.go @@ -47,6 +47,7 @@ func (s *RouterSuite) SetUpTest(c *check.C) { func (s *RouterSuite) TestOptions(c *check.C) { token := arvadostest.ActiveToken for _, trial := range []struct { + comment string // unparsed -- only used to help match test failures to trials method string path string header http.Header @@ -120,6 +121,32 @@ func (s *RouterSuite) TestOptions(c *check.C) { shouldCall: "CollectionList", withOptions: arvados.ListOptions{Limit: 123, Offset: 456, IncludeTrash: true, IncludeOldVersions: true}, }, + { + comment: "form-encoded expression filter in query string", + method: "GET", + path: "/arvados/v1/collections?filters=[%22(foo25M body + // is accepted even though the default Go request size + // limit is 10M. + 50000000, + } { + s.rtr.config.MaxRequestSize = maxRequestSize + okstr := "a" + for len(okstr) < maxRequestSize/2 { + okstr = okstr + okstr + } + + hdr := http.Header{"Content-Type": {"application/x-www-form-urlencoded"}} + + body := bytes.NewBufferString(url.Values{"foo_bar": {okstr}}.Encode()) + _, rr, _ := doRequest(c, s.rtr, token, "POST", `/arvados/v1/collections`, hdr, body) + c.Check(rr.Code, check.Equals, http.StatusOK) + + body = bytes.NewBufferString(url.Values{"foo_bar": {okstr + okstr}}.Encode()) + _, rr, _ = doRequest(c, s.rtr, token, "POST", `/arvados/v1/collections`, hdr, body) + c.Check(rr.Code, check.Equals, http.StatusRequestEntityTooLarge) + } +} + func (s *RouterIntegrationSuite) TestContainerList(c *check.C) { token := arvadostest.ActiveTokenV2