drill icon indicating copy to clipboard operation
drill copied to clipboard

Sending json in body example

Open richardltc opened this issue 1 year ago • 2 comments

Could I have an example of how to send json as a body payload please?

richardltc avatar Jul 17 '24 14:07 richardltc

This. Also how can you read a json body from a file?

elipp avatar Sep 05 '24 14:09 elipp

The similar way how you could do in Ansible

One way is:

- name: send request as list
  request:
  ...
    body: '{{ item }}'
  ...
  with_items:
    - '{"a":"b","c":{ "d":"e","f":"g"}}
    - '{"x":"y"}'
    -....

OR with "with_items_from_csv" as in the documentation, you can find the example file in "example/fixtures/transactions.csv". Actually the important thing here is that you need to name the dataset somehow. and add the lines. In the example it is "txn" and that's why this is the way how we can use it: body: '{{ item.txn }}' that say "please itearet through the items in txn dataset" (something like that :D).

The benchmark.yaml file contains all the examples.

milkfinch avatar Sep 13 '24 07:09 milkfinch