Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2894)

Unified Diff: appengine/findit/common/http_client_appengine.py

Issue 2116073002: [Findit] Fix redirect bug and update template for waterfall/culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add one unittest. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/common/rietveld.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/http_client_appengine.py
diff --git a/appengine/findit/common/http_client_appengine.py b/appengine/findit/common/http_client_appengine.py
index aabcb16dd4e7892c794159d5819cce9b4c467844..11aca4f4771455bb278569cf53b448c456c8037c 100644
--- a/appengine/findit/common/http_client_appengine.py
+++ b/appengine/findit/common/http_client_appengine.py
@@ -23,6 +23,10 @@ _INTERNAL_HOSTS_TO_SCOPES = {
class HttpClientAppengine(RetryHttpClient): # pragma: no cover
"""A http client for running on appengine."""
+ def __init__(self, follow_redirects=True, *args, **kwargs):
+ super(HttpClientAppengine, self).__init__(*args, **kwargs)
+ self.follow_redirects = follow_redirects
+
def _ExpandAuthorizationHeaders(self, headers, scope):
headers['Authorization'] = 'Bearer ' + auth_util.GetAuthToken(scope)
@@ -48,11 +52,11 @@ class HttpClientAppengine(RetryHttpClient): # pragma: no cover
if method in (urlfetch.POST, urlfetch.PUT):
result = urlfetch.fetch(
url, payload=data, method=method, headers=headers, deadline=timeout,
- follow_redirects=False, validate_certificate=True)
+ follow_redirects=self.follow_redirects, validate_certificate=True)
else:
result = urlfetch.fetch(
url, headers=headers, deadline=timeout,
- follow_redirects=False, validate_certificate=True)
+ follow_redirects=self.follow_redirects, validate_certificate=True)
if (result.status_code != 200 and self._ShouldLogError(result.status_code)):
logging.error('Request to %s resulted in %d, headers:%s', url,
« no previous file with comments | « no previous file | appengine/findit/common/rietveld.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698