Skip to content

Commit

Permalink
fix allow-origin header getting over-written
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseCrocker committed May 20, 2014
1 parent cb69607 commit 9ee2965
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TileStache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ def requestHandler2(config_hint, path_info, query_string=None, script_name=''):
except KeyError:
callback = None

if layer.allowed_origin:
headers.setdefault('Access-Control-Allow-Origin', layer.allowed_origin)

#
# Special case for index page.
#
Expand Down Expand Up @@ -255,7 +252,10 @@ def requestHandler2(config_hint, path_info, query_string=None, script_name=''):

else:
status_code, headers, content = layer.getTileResponse(coord, extension)


if layer.allowed_origin:
headers.setdefault('Access-Control-Allow-Origin', layer.allowed_origin)

if callback and 'json' in headers['Content-Type']:
headers['Content-Type'] = 'application/javascript; charset=utf-8'
content = '%s(%s)' % (callback, content)
Expand Down

0 comments on commit 9ee2965

Please sign in to comment.