Using Default Options

Example

from apidaora import appdaora, route


@route.get('/app-options')
async def app_options() -> str:
    return 'Options'


@route.get('/route-options', options=True)
async def route_options() -> str:
    return 'Options'


app = appdaora([app_options, route_options], options=True)

Running

Running the server:

uvicorn myapp:app
INFO: Started server process [16220]
INFO: Waiting for application startup.
INFO: ASGI 'lifespan' protocol appears unsupported.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Quering the route options

curl -i localhost:8000/app-options -X OPTIONS
HTTP/1.1 204 No Content
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
allow: GET

Quering the app options

curl -i localhost:8000/route-options -X OPTIONS
HTTP/1.1 204 No Content
date: Thu, 1st January 1970 00:00:00 GMT
server: uvicorn
allow: GET