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

Scope each request #1

Closed
wants to merge 1 commit into from
Closed

Scope each request #1

wants to merge 1 commit into from

Conversation

thetrevdev
Copy link
Owner

What does this implement/fix? Explain your changes.

Fixes -> https://codesandbox.io/s/purple-star-n3ohc?file=/src/index.js

This scopes the request object to an individual request. This allows for calling a wrapped handler multiple times concurrently. This is useful when trying to reuse individual handlers when batching. Without this a handler may receive the wrong request or return the incorrect response when calling concurrently.

Does this close any currently open issues?

middyjs#558

Any other comments?

This could be considered a breaking change if someone was mutating the handler object intending it to persist between requests.
That being said there would be no reason to store your global state on the handler itself unless you thought it was scoped per request which this implements.

Where has this been tested?

Node.js Versions: 10/12

Middy Versions: 1.2.0

AWS SDK Versions: 2.713.0

Todo list

[x] Feature/Fix fully implemented
[ ] Added tests
[ ] Updated relevant documentation
[ ] Updated relevant examples

@thetrevdev thetrevdev closed this Aug 29, 2020
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.

1 participant