Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POST request with wrk?

I started to try wrk. It's very simple to use and very hard on the server, but I don't know how to perform other kind of request such as POST. In fact, I don't even know if this tool allows it. The documentation is very minimal.

Thanks

like image 780
jackdbernier Avatar asked Mar 07 '13 01:03

jackdbernier


2 Answers

This is possible now. Here is an example https://github.com/wg/wrk/blob/master/scripts/post.lua.

wrk.method = "POST" wrk.body   = "foo=bar&baz=quux" wrk.headers["Content-Type"] = "application/x-www-form-urlencoded" 

save this in a *.lua script and pass it into your command line test with the -s flag.

like image 134
Steve Avatar answered Sep 16 '22 11:09

Steve


for those looking for a content-type "application/json" example:

wrk.method = "POST" wrk.body = '{"firstKey": "somedata", "secondKey": "somedata"}' wrk.headers["Content-Type"] = "application/json" 
like image 27
Emmanuel N K Avatar answered Sep 20 '22 11:09

Emmanuel N K