Skip to content

Maintenance: Reflect Change From HandlerOptions to RequestContext in REST API Resolvers #4459

@svozza

Description

@svozza

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

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/shippedevent-handlerThis item relates to the Event Handler UtilityinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)

Type

No type

Projects

Status

Shipped

Relationships

None yet

Development

No branches or pull requests

Issue actions