-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Proposal
Add the ability to associate and process individual request results dynamically, enabling request chaining or result-aware target generation.
Specifically, extend the Target or Attacker model to optionally include a callback (e.g., OnResponse func(*Result) ([]Target, error)) that allows users to inspect the HTTP response and generate subsequent requests based on its data.
This feature would make Vegeta suitable for more complex and realistic load-testing scenarios, where later requests depend on values (tokens, IDs, etc.) returned by previous responses — without breaking existing behavior for stateless tests.
Background
Currently, Vegeta operates in a fully stateless “fire-and-forget” mode. Each request is independent, and there’s no native way to correlate a response with the next request or dynamically adjust targets during the attack.
This limitation makes it difficult to use Vegeta for APIs that involve authentication, session tokens, or any kind of data dependency between requests.
While this design is ideal for pure throughput testing, many real-world systems (e.g., REST APIs, microservices, user flows) require stateful or sequential request chains to simulate realistic behavior.
Introducing a response hook or target identifier would enable Vegeta to support these cases without sacrificing its simplicity or performance model.
Workarounds
Currently, the only viable workaround is to build an external scenario controller in Go that orchestrates Vegeta programmatically — invoking vegeta.Attacker manually and feeding it dynamically generated targets after processing results.
While functional, this approach:
- Significantly increases code complexity;
- Duplicates effort across users who need similar chaining behavior;
- Makes it harder to reuse Vegeta’s CLI and native workflows.
A lightweight built-in mechanism (such as a response callback or an optional Target.ID field) would make dynamic chaining straightforward and maintain the tool’s ergonomics for advanced users.