You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
None is the default value of headers. If none are set, the following exception is raised:
Traceback (most recent call last):
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask_cors/extension.py", line 173, in cors_after_request
if resp.headers.get(ACL_ORIGIN):
This can happen with unhandled exceptions which cause a 500 error, or any response that does not set headers.
The text was updated successfully, but these errors were encountered:
Been having this problem on 3.0.8.
I think it started after I added health check api path, but don't understand exactly why.
My currently code for before_request and after_request is:
# Log before request.
@app.before_request
def before():
g.start = time.time()
g.status = 0
if request.endpoint == 'main.health_check':
g.status = 1
pass
else:
logger.debug(f'Received request to endpoint [{request.endpoint}], in blueprint [{request.blueprint}] and security [{request.is_secure}].')
# Useful debugging interceptor to log all endpoint responses
@app.after_request
def after(response):
if g.status == 1:
pass
else:
now = time.time()
duration = round(now - g.start, 2)
duration = time.localtime(duration)
duration = str(duration[4]) + 'm:' + str(duration[5]) + 's'
logger.debug(f'Finished request: [{response.status}], with [{response.data.decode("utf-8")}] and took [{duration}] seconds.')
return response
None is the default value of headers. If none are set, the following exception is raised:
This can happen with unhandled exceptions which cause a 500 error, or any response that does not set headers.
The text was updated successfully, but these errors were encountered: