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

send advanced http request and capture response using wrk/wrk2 #23

Open
mpabbidi opened this issue May 31, 2016 · 6 comments
Open

send advanced http request and capture response using wrk/wrk2 #23

mpabbidi opened this issue May 31, 2016 · 6 comments

Comments

@mpabbidi
Copy link

Hi
I am trying to use wrk to soak my REST API interface in a product.
As part of the I am trying to send the wrk request for the below request (given at the bottom).
I am not able to set the –d options properly via json file or wrk array.
Will you be able to provide me proper wrk array format or Jason format.
I am NOT planning to use docker. As my server is not standalone web server. Its part of the product.

also I want to see the response to validate it.

Appreciate any help.
Thanks
M
Curl request taht want to send via wrk.
curl -k -i -d '{"jsonrpc":"2.0","id":101,"method":"ProvisionSubscriberInfo", "params":{"info": {"thing1": "@object_1"},"subId": 911}}' -X POST https://TPC-D7-07-001.phaedrus.sandvine.com/policyengine/v1/functions/ -H 'Authorization:

@suni1mp
Copy link

suni1mp commented Oct 11, 2016

Hi @mpabbidi ,

did you figure out the above option with wrk ? , if so request you share the steps

Thanks

@GrayedFox
Copy link

Also interested in learning how to send a JSON type body with wrk...

@wandenberg
Copy link

wandenberg commented Jan 31, 2017

@suni1mp and @GrayedFox you can write a lua script and configure the wrk.body and wrk.headers.
something like

wrk.headers["Content-Type"] = "application/json"
wrk.body = '{"my":"json"}'

or in a dynamic way

request = function()
wrk.format(method, path, headers, body)
    -- you can create the values dynamically here using lua
    return wrk.format('POST','/resource/path', {["Content-Type"]= "application/json"}, '{"my":"json"}')
end

I got this information from here
It also recommends for performance to create your requests first if they have a lot of logic.

@GrayedFox
Copy link

Thanks man will give that a go when I'm next doing some stress testing

@rex-remind101
Copy link

@wandenberg should {"Content-Type": "application/json"} actually be {["Content-Type"]= "application/json"}?

@wandenberg
Copy link

wandenberg commented Nov 22, 2020

Correct @rex-remind101
Thanks for noticing. I edited the example to make it easier.

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

5 participants