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

Unified Diff: net/tools/testserver/testserver.py

Issue 8203005: Implement chrome.experimental.downloads.onChanged (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 8 years, 10 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
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index f9177897cc6e17b64a3fa075498365b96f0a7b81..40ac17d48b1540b94c8cefdfd87b74d95948946e 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -909,7 +909,7 @@ class TestPageHandler(BasePageHandler):
if not self.path.startswith(prefix):
return False
# Consume a request body if present.
- if self.command == 'POST' or self.command == 'PUT' :
+ if self.command == 'POST' or self.command == 'PUT':
self.ReadRequestBody()
return self._FileHandlerHelper(prefix)
@@ -918,7 +918,15 @@ class TestPageHandler(BasePageHandler):
prefix = urlparse.urljoin(self.server.file_root_url, 'post/')
if not self.path.startswith(prefix):
return False
- self.ReadRequestBody()
+ body = self.ReadRequestBody()
+ _, _, _, _, query_str, _ = urlparse.urlparse(self.path)
+ query_dict = cgi.parse_qs(query_str)
+ expected_body = query_dict.get('expected_body', [])
+ if body not in expected_body:
+ self.send_response(404)
+ self.end_headers()
+ self.wfile.write('')
+ return True
return self._FileHandlerHelper(prefix)
def _FileHandlerHelper(self, prefix):

Powered by Google App Engine
This is Rietveld 408576698