Skip to content

Commit 08983f8

Browse files
committed
Added simple client side cache support via cache-control header.
Fixed content-type header is overridden by App Engine.
1 parent 163e38d commit 08983f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/core.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# Request Handlers
2525
class Handler(webapp2.RequestHandler):
2626
__CORS = True
27+
2728
def __init__(self, *args, **kwargs):
2829
super(Handler, self).__init__(*args, **kwargs)
2930

@@ -151,9 +152,11 @@ def get(self, username):
151152
analytics = self.get_option('a', '1')
152153
jsonp = self.request.get('callback', '')
153154
if jsonp: # jsonp header should be there always
154-
self.response.headers.add_header('content-type',
155-
'application/javascript',
156-
charset='utf-8')
155+
self.response.headers['content-type'] = \
156+
'application/javascript; charset = utf-8'
157+
158+
self.response.headers['cache-control'] = \
159+
'public, max-age={}'.format(MEMCACHE_EXPIRATION/2)
157160

158161
memcache_key = '{0}?{1}sa{2}j{3}'.format(username, support,
159162
analytics, jsonp)

0 commit comments

Comments
 (0)