Dyalog / Jarvis

APL-based web service framework supporting JSON or REST
https://dyalog.github.io/Jarvis/
MIT License
33 stars 6 forks source link

Add CORS support defaults into JSON Server #11

Closed arcfide closed 4 years ago

arcfide commented 4 years ago

This adds defaults for CORS support into the JSON server paradigm. Different handling can be accomplished by using the Validation step to adjust headers in the response. Additionally, if you don't want to use any defaults at all and just want to tweak your response completely, then you can signal an immediate response from the Validation frunction by return a -1 instead of a 0. Otherwise, you can set only the headers you want, and then use the defaults by returning 0 and letting the request fall through.