| OLD | NEW |
| 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 class Request(object): | 5 class Request(object): |
| 6 '''Request data. | 6 '''Request data. |
| 7 ''' | 7 ''' |
| 8 def __init__(self, path, headers): | 8 def __init__(self, path, headers): |
| 9 self.path = path | 9 self.path = path |
| 10 self.headers = headers | 10 self.headers = headers |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 self.headers[key] = value | 83 self.headers[key] = value |
| 84 | 84 |
| 85 def AddHeaders(self, headers): | 85 def AddHeaders(self, headers): |
| 86 '''Adds several headers to the response. | 86 '''Adds several headers to the response. |
| 87 ''' | 87 ''' |
| 88 self.headers.update(headers) | 88 self.headers.update(headers) |
| 89 | 89 |
| 90 def SetStatus(self, status): | 90 def SetStatus(self, status): |
| 91 self.status = status | 91 self.status = status |
| 92 | 92 |
| 93 def IsRedirect(self): |
| 94 return 'Location' in self.headers |
| 95 |
| 93 def __repr__(self): | 96 def __repr__(self): |
| 94 return '{content: %s bytes, status: %s, headers: %s entries}' % ( | 97 return '{content: %s bytes, status: %s, headers: %s entries}' % ( |
| 95 len(self.content), self.status, len(self.headers.keys())) | 98 len(self.content), self.status, len(self.headers.keys())) |
| 96 | 99 |
| 97 class Servlet(object): | 100 class Servlet(object): |
| 98 def __init__(self, request): | 101 def __init__(self, request): |
| 99 self._request = request | 102 self._request = request |
| 100 | 103 |
| 101 def Get(self): | 104 def Get(self): |
| 102 '''Returns a Response. | 105 '''Returns a Response. |
| 103 ''' | 106 ''' |
| 104 raise NotImplemented() | 107 raise NotImplemented() |
| OLD | NEW |