-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
The current definition:
export declare type PullZoneHandler = {
/**
* Add a Middleware for the requests being processed.
*/
onOriginRequest: (middleware: (ctx: OriginRequestContext) => Promise<Request> | Promise<Response>) => PullZoneHandler;
/**
* Add a Middleware for the response being processed.
*/
onOriginResponse: (middleware: (ctx: OriginResponseContext) => Promise<Response>) => PullZoneHandler;
};
But I think it should also accept Promise<Request | Response> return type as the response might depend on the body of the callback function. Imagine a middleware, which return a Response on authentication failure, but returns the original Request on success.
Suggested:
export declare type PullZoneHandler = {
/**
* Add a Middleware for the requests being processed.
*/
onOriginRequest: (middleware: (ctx: OriginRequestContext) => Promise<Request> | Promise<Response> | Promise<Request | Response>) => PullZoneHandler;
/**
* Add a Middleware for the response being processed.
*/
onOriginResponse: (middleware: (ctx: OriginResponseContext) => Promise<Response>) => PullZoneHandler;
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels