mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
cors: fix some http response error not being catched by cors decorator
This commit is contained in:
parent
20d3b82340
commit
924fd7825e
1 changed files with 5 additions and 1 deletions
|
@ -734,7 +734,11 @@ class Interface:
|
|||
|
||||
def cors(callback):
|
||||
def wrapper(*args, **kwargs):
|
||||
r = callback(*args, **kwargs)
|
||||
try:
|
||||
r = callback(*args, **kwargs)
|
||||
except HTTPResponse as e:
|
||||
r = e
|
||||
|
||||
origin = request.headers.environ.get("HTTP_ORIGIN", "")
|
||||
if origin and origin in self.allowed_cors_origins:
|
||||
resp = r if isinstance(r, HTTPResponse) else response
|
||||
|
|
Loading…
Reference in a new issue