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

Side by Side Diff: chrome/common/extensions/docs/server2/servlet.py

Issue 311793002: Docserver: Fix broken redirect on code.google.com/chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: also test http Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/render_servlet_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 class RequestHeaders(object): 6 class RequestHeaders(object):
7 '''A custom dictionary impementation for headers which ignores the case 7 '''A custom dictionary impementation for headers which ignores the case
8 of requests, since different HTTP libraries seem to mangle them. 8 of requests, since different HTTP libraries seem to mangle them.
9 ''' 9 '''
10 def __init__(self, dict_): 10 def __init__(self, dict_):
(...skipping 14 matching lines...) Expand all
25 25
26 class Request(object): 26 class Request(object):
27 '''Request data. 27 '''Request data.
28 ''' 28 '''
29 def __init__(self, path, host, headers): 29 def __init__(self, path, host, headers):
30 self.path = path.lstrip('/') 30 self.path = path.lstrip('/')
31 self.host = host.rstrip('/') 31 self.host = host.rstrip('/')
32 self.headers = RequestHeaders(headers) 32 self.headers = RequestHeaders(headers)
33 33
34 @staticmethod 34 @staticmethod
35 def ForTest(path, host='http://developer.chrome.com', headers=None): 35 def ForTest(path, host=None, headers=None):
36 return Request(path, host, headers or {}) 36 return Request(path, host or 'http://developer.chrome.com', headers or {})
37 37
38 def __repr__(self): 38 def __repr__(self):
39 return 'Request(path=%s, host=%s, headers=%s)' % ( 39 return 'Request(path=%s, host=%s, headers=%s)' % (
40 self.path, self.host, self.headers) 40 self.path, self.host, self.headers)
41 41
42 def __str__(self): 42 def __str__(self):
43 return repr(self) 43 return repr(self)
44 44
45 class _ContentBuilder(object): 45 class _ContentBuilder(object):
46 '''Builds the response content. 46 '''Builds the response content.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return repr(self) 150 return repr(self)
151 151
152 class Servlet(object): 152 class Servlet(object):
153 def __init__(self, request): 153 def __init__(self, request):
154 self._request = request 154 self._request = request
155 155
156 def Get(self): 156 def Get(self):
157 '''Returns a Response. 157 '''Returns a Response.
158 ''' 158 '''
159 raise NotImplemented() 159 raise NotImplemented()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/render_servlet_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698