lambda-decorators
lambda-decorators copied to clipboard
Multipe domain & wildcard support for CORS
Enable usage like this, list of domains & support wildcards in strings:
>>> @cors_headers(origin=['https://example.com', 'https://*.example.com'])
... def hello_custom_origin(example, context):
... return {'body': 'foobar'}
>>> hello_custom_origin({'headers': {'Host': 'https://foobar.example.com'}}, object())
{'body': 'foobar', 'headers': {'Access-Control-Allow-Origin': 'https://foobar.example.com'}