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

Add TransferRate response extension to throttle the response stream for any response #94

Closed
skwasjer opened this issue Dec 22, 2023 · 0 comments · Fixed by #96
Closed
Labels
enhancement New feature or request

Comments

@skwasjer
Copy link
Owner

skwasjer commented Dec 22, 2023

Currently the RateLimitedStream can be used to throttle the transfer rate of a stream based response, but it requires another stream (to wrap). It would be ideal to have a ResponseBuilder extension that makes it possible to throttle any type of response content, be it string content, byte array, json, xml, etc. This makes it really useful to test client implementations that operate on generally slow connections, IOT/wireless devices, etc.

The behavior should not be mutually exclusive with Latency but instead - if configured together - work together. The behaviors should always run in the correct order (and before any other unrelated behavior), regardless of how the user configures it through the fluent API.

Something like:

mockHttp
    .When(...)
    .Respond(with => with
        .Body(...)
        .Latency(TwoG)
        .TransferRate(TwoG)
    );

Where the behavior pipeline should become:

  • latency > transfer rate > status code > body > etc.
@skwasjer skwasjer added the enhancement New feature or request label Dec 22, 2023
@skwasjer skwasjer changed the title Add TransferRate response extension to enable rate limiting any response Add TransferRate response extension to throttle the response stream for any response Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant