Add CORS middleware

This commit is contained in:
Brahim Hadriche committed 2022-11-25 13:29:48 -05:00
1 parent 386dfc1419
commit 02e44960b7
4 files changed
+28 -1

No files matched your search

@@ -0,0 +1,21 @@
namespace Http
class CorsMiddleware extends HttpRouter
private origin
function new(origin = "*" as string)
super()
m.origin = origin
m.All("*", function(context as object) as boolean
router = context.router
response = context.response
response.allow_origin = router.origin
return false
end function)
end function
end class
end namespace