rymcol / TitanCORS

Helper functions to add CORS support to Titan apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TitanCORS

Helper functions to add CORS support to Titan apps.

I don't know what CORS is and I don't care about security

let titanInstance = Titan()
TitanCORS.addInsecureCORSSupport(titanInstance)

I know what CORS is and I don't care about security but I'm not letting you mess with my Titan instance

Good stuff.

titanInstance.addFunction(allowAllOrigins) // Add wildcard origin header to all responses
titanInstance.addFunction(respondToPreflightAllowingAllMethods) // Respond to a CORS preflight option request allowing all methods requested

I know what CORS is and I want to customize it

Please open a PR! We need these methods, and they shouldn't be hard to implement:

func AllowSomeOrigins(_ origins: [String]) -> Function
func RespondToPreflight(allowingSpecificMethods methods: [String]) -> Function

About

Helper functions to add CORS support to Titan apps

License:Apache License 2.0


Languages

Language:Swift 100.0%