generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 175
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedevent-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler UtilityinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Milestone
Description
Summary
In #4439 we renamed HandlerOptions
to RequestContext
to reflect that it is more of a container for state now rather than configuration. We should update all the tests that use the name options
or similar when referring to reqCtx
to make this change clear.
Why is this needed?
It is confusing for us to refer to a context object as an options object when the latter implies it only contains configuration.
Which area does this relate to?
Event Handler
Solution
Rename any parameters in middleware or route handlers that are of type RequestContext
from options
to reqCtx
:
// old
const middleware: Middleware = async (params, options, next) => {
options.res.headers.set('X-Before', 'Before');
await next();
options.res.headers.set('X-After', 'After');
}
// new
const middleware: Middleware = async (params, reqCtx, next) => {
reqCtx.res.headers.set('X-Before', 'Before');
await next();
reqCtx.res.headers.set('X-After', 'After');
}
Acknowledgment
- This request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedevent-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler UtilityinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Type
Projects
Status
Shipped