Skip to content

Commit

Permalink
Fix * option
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsocv12 committed Nov 18, 2020
1 parent eb9926a commit 7f7a364
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions bottle_cors_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ def _get_origin(self):
Function dedicated to return origin if is on list
'''
client_origin = request.headers.get('Origin', None)
if not client_origin or '*' in self.origins:
return self.origins
if '*' in self.origins: return '*'
if not client_origin:
return self.origins[0]
for origin in self.origins:
if origin == client_origin:
return origin
return self.origins
return self.origins[0]

def abort(self, code=500, text='Unknown Error.'):
""" Aborts execution and causes a HTTP error. """
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setuptools.setup(
name='bottle-cors-plugin',
version='0.1.8',
version='0.1.9',
author="Alfonso Villalobos",
author_email="alfonso@codepeat.com",
license='MIT',
Expand Down

0 comments on commit 7f7a364

Please sign in to comment.