Permalink
Browse files

Added simple client side cache support via cache-control header.

Fixed content-type header is overridden by App Engine.
  • Loading branch information...
BYK committed Dec 28, 2011
1 parent 163e38d commit 08983f8d60e53a1798e07b2d772252eb1b65919a
Showing with 6 additions and 3 deletions.
  1. +6 −3 app/core.py
View
@@ -24,6 +24,7 @@
# Request Handlers
class Handler(webapp2.RequestHandler):
__CORS = True
def __init__(self, *args, **kwargs):
super(Handler, self).__init__(*args, **kwargs)
@@ -151,9 +152,11 @@ def get(self, username):
analytics = self.get_option('a', '1')
jsonp = self.request.get('callback', '')
if jsonp: # jsonp header should be there always
self.response.headers.add_header('content-type',
'application/javascript',
charset='utf-8')
self.response.headers['content-type'] = \
'application/javascript; charset = utf-8'
self.response.headers['cache-control'] = \
'public, max-age={}'.format(MEMCACHE_EXPIRATION/2)
memcache_key = '{0}?{1}sa{2}j{3}'.format(username, support,
analytics, jsonp)

0 comments on commit 08983f8

Please sign in to comment.