Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending json in body example #194

Open
richardltc opened this issue Jul 17, 2024 · 2 comments
Open

Sending json in body example #194

richardltc opened this issue Jul 17, 2024 · 2 comments

Comments

@richardltc
Copy link

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

@elipp
Copy link

elipp commented Sep 5, 2024

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

@milkfinch
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants