With the middleware function, these headers are not set. Expected behavior is that CORS headers would be set app-wide when using app.api.cors. I cannot find anything in the docs indicating that CORS should not be set by middleware.
I have the same problem, using a middleware to validate the request and throwing BadRequestError if invalid.
If the error is thrown cors header is not set leading to problems on client side.
chalice 1.29.0 Python 3.11.4 Windows 10.0.19045 Build 19045
Without the middleware,
/test
returns headersWith the middleware function, these headers are not set. Expected behavior is that CORS headers would be set app-wide when using
app.api.cors
. I cannot find anything in the docs indicating that CORS should not be set by middleware.