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

foundation simulator delay response API #285

Merged
merged 3 commits into from
Sep 13, 2024
Merged

foundation simulator delay response API #285

merged 3 commits into from
Sep 13, 2024

Conversation

jbolda
Copy link
Contributor

@jbolda jbolda commented Aug 28, 2024

Motivation

Add API to delay responses to improve "real API feel".

Approach

Add middleware which takes an input or an environment variable to configure response delays.

@jbolda jbolda requested a review from cowboyd August 28, 2024 17:31
@frontsidejack
Copy link
Member

frontsidejack commented Aug 28, 2024

Package Changes Through e4027ef

There are 1 changes which include @simulacrum/foundation-simulator with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@simulacrum/foundation-simulator 0.1.0 0.2.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Copy link
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you configure the delay from within a test case? Maybe with a header? Or with a specific control API?

packages/foundation/src/middleware/delay.ts Outdated Show resolved Hide resolved
@jbolda
Copy link
Contributor Author

jbolda commented Sep 6, 2024

How do you configure the delay from within a test case? Maybe with a header? Or with a specific control API?

I haven't really ventured too far down controlling from tests. In part because I haven't had the need, but also I really just want my tests to run fast 🤣 .

It does feel worthwhile to support, but I am comfortable punting on it for now. I am not terribly keen on headers because then your production code paths might need to muddy themselves up with that header. Control API feels better, but I don't think we have enough in place to support that yet. What do you think?

Copy link
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jbolda jbolda merged commit 8f46cd4 into main Sep 13, 2024
4 checks passed
@jbolda jbolda deleted the foundation-delay branch September 13, 2024 14:07
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

Successfully merging this pull request may close these issues.

3 participants