Files
playlet-piped/src/components/WebServer/Middleware/CorsMiddleware.bs
T
Brahim Hadriche 1734425b9c [Refactor] web server header cleanups (#16)
* Rename variables

* Content type headers

* Headers cleanup
2022-11-29 18:43:23 -05:00

22 lines
513 B
Plaintext

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.headers["Access-Control-Allow-Origin"] = router.origin
return false
end function)
end function
end class
end namespace