Skip to content

Instantly share code, notes, and snippets.

@anokun7
Last active December 22, 2019 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anokun7/f03a597b396e58c9999bd8af4fb75016 to your computer and use it in GitHub Desktop.
Save anokun7/f03a597b396e58c9999bd8af4fb75016 to your computer and use it in GitHub Desktop.

Example of using Apache Bench command to post data to a url (on a mac):

I use bat instead of cat

$$>> bat data.json
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: delete.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {"Another": "Echo"}
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
$$>> ab -l -d -q -r -S -c 249 -n 999999 -T 'application/json' -p data.json http://<url>:<port>/

The above is the equivalent in curl as below:

curl -L --data '{"Another": "Echo"}' \
 --header "Content-Type:application/json" \
 http://<url>:<port>/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment