joy-framework / joy

A full stack web framework written in janet
https://joy.swlkr.com
MIT License
537 stars 30 forks source link

Add CORS middleware #65

Closed cpjolicoeur closed 4 years ago

cpjolicoeur commented 4 years ago

There are no tests with this PR. I didn't see much in the way of integration tests in the codebase yet.

I can try to add some tests for this middleware if you want, but it appeared that the existing testing around middleware was, for the most part, non-existent as of now.

This is still a pretty simple (naive) implementation of CORS. Let me know if you want the default expanded on. Many CORS libs include all methods, and various other headers by default. This implementation currently also does not handle CORS credentials flags or the Vary header.

If you want these things included, then the work here can be expanded on.