Skip to content

Expose addCorsHeaders#20

Open
jacwright wants to merge 2 commits into
kwhitley:v0.xfrom
jacwright:add-cors
Open

Expose addCorsHeaders#20
jacwright wants to merge 2 commits into
kwhitley:v0.xfrom
jacwright:add-cors

Conversation

@jacwright

@jacwright jacwright commented Mar 26, 2022

Copy link
Copy Markdown
Contributor

This should allow cors headers to be added at the end of a call.

Really, Response middleware (like ThrowableRouter) should be made stackable so we can have CorsRouter.

Maybe something like this?

const router = CorsRouter(corsOptions, ThrowableRouter({ stack: true }, Router({ base: '/' })))

Or perhaps:

const router = Router();
...
  event.respondWith(isThrowable(router.handle(event.request)))

This should allow cors headers to be added at the end of a call.

Really, Response middleware (like ThrowableRouter) should be made stackable so we can have CorsRouter.

Maybe something like this?
```
const router = CorsRouter(corsOptions, ThrowableRouter({ stack: true }, Router({ base: '/' })))
```
@kwhitley

kwhitley commented Apr 4, 2022

Copy link
Copy Markdown
Owner

Really, Response middleware (like ThrowableRouter) should be made stackable so we can have CorsRouter.

Agreed!

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.

2 participants