1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 check "gopkg.in/check.v1"
14 func (s *RouterSuite) TestAttrsInBody(c *check.C) {
15 for _, body := range []string{
17 `{"model_name": {"foo":"bar"}}`,
19 c.Logf("body: %s", body)
20 req := httptest.NewRequest("POST", "https://an.example/ctrl", bytes.NewBufferString(body))
21 req.Header.Set("Content-Type", "application/json")
22 params, err := s.rtr.loadRequestParams(req, "model_name")
23 c.Assert(err, check.IsNil)
24 c.Logf("params: %#v", params)
25 c.Check(params, check.NotNil)
26 c.Assert(params["attrs"], check.FitsTypeOf, map[string]interface{}{})
27 c.Check(params["attrs"].(map[string]interface{})["foo"], check.Equals, "bar")