Don't include pixel tracker URL in response headers if not enabled.

If the tracker URL isn't configured, we shouldn't include the header in
the response.  This uses the same criteria (truthiness of g.tracker_url)
as the templates to determine whether or not to include the URL.
This commit is contained in:
Neil Williams
2015-02-12 13:52:42 -08:00
parent 946e721cbe
commit 1da41d8063

View File

@@ -1661,7 +1661,7 @@ class RedditController(OAuth2ResourceController):
g.stats.simple_event('cors.api_request')
g.stats.count_string('origins', request_origin)
if request.method.upper() == "GET" and is_api():
if g.tracker_url and request.method.upper() == "GET" and is_api():
tracking_url = make_url_https(get_pageview_pixel_url())
response.headers["X-Reddit-Tracking"] = tracking_url