GithubHelp home page GithubHelp logo

Comments (6)

wandenberg avatar wandenberg commented on July 21, 2024 7

@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.

from wrk2.

suni1mp avatar suni1mp commented on July 21, 2024

Hi @mpabbidi ,

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

Thanks

from wrk2.

GrayedFox avatar GrayedFox commented on July 21, 2024

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

from wrk2.

GrayedFox avatar GrayedFox commented on July 21, 2024

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

from wrk2.

rex-remind101 avatar rex-remind101 commented on July 21, 2024

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

from wrk2.

wandenberg avatar wandenberg commented on July 21, 2024

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

from wrk2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.