taurus POST url test with list in body

1,308 views
Skip to first unread message

Raul Cuth

unread,
Mar 1, 2017, 2:52:30 AM3/1/17
to codename-taurus
I have to test some POST requests for an API that has a list of an object as a parameter(List<MyObject>).

I would like to know if there is a way to have a list in the body, because, for now i get the error(Cannot handle 'body' option of type list).

Thank you all for your help.

Andrey Pokhilko

unread,
Mar 1, 2017, 3:28:06 AM3/1/17
to codenam...@googlegroups.com

Hi,

Can you show an example of config you're trying to use?

--

Andrey

--
You received this message because you are subscribed to the Google Groups "codename-taurus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codename-taur...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codename-taurus/07eb663c-d286-48a9-a4b0-552ff42c5259%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raul Cuth

unread,
Mar 1, 2017, 3:53:06 AM3/1/17
to codename-taurus, Andrey....@contractor.ca.com
Hi Andrey,
I'm very new to this taurus testing and i don't have any configuration. I just created the .yml file with a scenario and i am trying to test an url and run it with the bzt command
scenarios:
  insert-for-user:
    requests:
      - url: http://localhost:8991/api/endpoint
       
method: POST
       
body:
          - userId: 101qwerty123
           
attrName: testattribute
       
headers:
          Content-Type: application/json

I also tried with JSON instead of yaml syntax in the body like: [{object}]

Thank you for your help.

Andrey Pokhilko

unread,
Mar 1, 2017, 3:58:56 AM3/1/17
to Raul Cuth, codename-taurus

Ok, help me to understand what do you expect to be sent to server for this situation? Which string should be sent as body?

--

Andrey

Raul Cuth

unread,
Mar 1, 2017, 4:21:14 AM3/1/17
to codename-taurus, raul...@gmail.com, Andrey....@contractor.ca.com
For example i need to send a list of JSON objects: [{"userId":"1234","attrName":"name"},{"userId":"321","attrName":"anothername"}]

Andrey Pokhilko

unread,
Mar 1, 2017, 4:35:19 AM3/1/17
to Raul Cuth, codename-taurus

So for workaround of a problem you can set string body now like this:

body: "[{\"userId\":\"1234\",\"attrName\":\"name\"},{\"userId\":\"321\",\"attrName\":\"anothername\"}]"

Meanwhile, we'll update the code to handle JSON arrays like you expect it. It will be part of next release 1.8.1

--

Andrey

Raul Cuth

unread,
Mar 1, 2017, 4:58:32 AM3/1/17
to codename-taurus, raul...@gmail.com, Andrey....@contractor.ca.com
It worked. Thanks a lot mate!
Reply all
Reply to author
Forward
0 new messages