rakyll / hey

HTTP load generator, ApacheBench (ab) replacement
Apache License 2.0
17.61k stars 1.17k forks source link

Support dynamic request uri, query params and payload (for -d and -D) #294

Closed adhocore closed 7 months ago

adhocore commented 1 year ago

Docs in README.md Tests in requester/generator_test.go

I use hey and needed a way to send dynamic payload (request body) to endpoint so this is the hack that I thought maybe useful to contribute.

While the docs and tests are based on JSON payload, it is agnostic of content type - all that matters is the placeholders are in the body template and it will be dynamically interpolated. The generator is activated only once at the start only if the body template contains at least one placeholder so otherwise it won't get in the way.

(PS: while at it i have refactored the deprecated ioutil usage)

fsabr commented 1 year ago

I would also love this feature!

@rakyll what do you think? Found some related issues, but for request query parameter: https://github.com/rakyll/hey/issues/35, https://github.com/rakyll/hey/pull/183

adhocore commented 1 year ago

i think it is neat and uniform to make query args and path uri dynamic in the same way and semantics as the body payload. a POC that I am working on is looking great, pushing it asap. i hope this will resolve all dynamic issues once and for all

adhocore commented 1 year ago

but getting it merged might be difficult

Ojasv-Singh-Zeotap commented 7 months ago

is this live?

adhocore commented 7 months ago

@Ojasv-Singh-Zeotap it isn't merged yet so no live

(seems it won't be ever so closing this PR for good, i was thinking of doing something of my own but can't afford to invest any more time) PS: if you are interested you can carry over my PR and maintain it somewhere else

jackgris commented 7 months ago

Sadly, I believe these changes will never be merged. However, I found them so useful that I forked the project and added them to my fork. Thanks for your work, @adhocore!