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

(Question) how to pass dinamic specific values? #506

Closed
fenix-hub opened this issue May 27, 2024 · 4 comments
Closed

(Question) how to pass dinamic specific values? #506

fenix-hub opened this issue May 27, 2024 · 4 comments

Comments

@fenix-hub
Copy link

fenix-hub commented May 27, 2024

Hi,

I would like to stress test an endpoint which consists of an HTTP DELETE request.
The path parameter is structured like so:

DELETE /entity/{id}

where {id} is a UUIDv4 generated by my database.
Since I'd like to execute multiple requests pointing to existing entities, I'd like to give a list of possible ids to oha in order to dinamically chose one from the sequence of given ids and execute the request, replacing the path parameter with the one from the sequence.

Even giving a file like this one:

# ids.txt

abcde
fedage
adaedae
dawaijwd

would be enough

@hatoo
Copy link
Owner

hatoo commented May 27, 2024

You can use --rand-regex-url option. Currently, it's the only feature for dynamic requests.
It's not good for a large amount of list, but enough for a small one.

oha --rand-regex-url "http://localhost:3000/(abcde|fedage|adaedae|dawaijwd)" -m DELETE

@fenix-hub
Copy link
Author

You can use --rand-regex-url option. Currently, it's the only feature for dynamic requests. It's not good for a large amount of list, but enough for a small one.

oha --rand-regex-url "http://localhost:3000/(abcde|fedage|adaedae|dawaijwd)" -m DELETE

Thank you @hatoo ,
this is more than enough!
Do you know any cli utility that could help creating that regex on the fly?
Like passing the list from the file to an intermediate pipeline, that replaces the list inside the regex string.

@hatoo
Copy link
Owner

hatoo commented May 28, 2024

Sorry, I don't know a cli to do such a thing.
If I were you, I would like to use some shell friendly script runtime such as bun shell.

@fenix-hub
Copy link
Author

Thank you very much for your help

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

2 participants