Hello baran,

I'd like you to do a code review.  Please execute
        g4 diff -c 8338791

or point your web browser to
        http://mondrian/8338791

to review the following code:

Change 8338791 by [EMAIL PROTECTED] on 2008/09/22 14:51:45 *pending*

        Bug fix in mock network location provider.
        
        R=baran
        [EMAIL PROTECTED]
        DELTA=19  (6 added, 1 deleted, 12 changed)
        OCL=8338791

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py#2
 edit

19 delta lines: 6 added, 1 deleted, 12 changed

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 8338791 by [EMAIL PROTECTED] on 2008/09/22 14:51:45 *pending*

        Bug fix in mock network location provider.

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py#2
 edit

==== 
//depot/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py#2
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py
 ====
# action=edit type=xtext
--- googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py 
2008-09-22 13:01:14.000000000 +0100
+++ googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py 
2008-09-22 15:49:43.000000000 +0100
@@ -151,19 +151,24 @@
   request_handler.outgoing.append (response)
 
 
-# Only respond if the request is a POST
+# We accept only POST requests with Content-Type application/json.
 if self.command == 'POST':
-  fix_request = None
-  if self.body :
-    request_body = self.body.popitem()[0]
-    fix_request = FixRequest(request_body)
+  if self.headers.get('Content-Type') == 'application/json':
+    if self.body :
+      fix_request = FixRequest(self.body)
 
-  # Hard-coded rules to return desired responses
-  if fix_request.HasMacAddress("good_mac_address"):
-    send_response(self, 200, GOOD_JSON_RESPONSE)
-  elif fix_request.HasMacAddress("no_location_mac_address"):
-    send_response(self, 200, NO_LOCATION_JSON_RESPONSE)
-  elif fix_request.HasCellId(88):
-    send_response(self, 400, "Error in request")
+      # Hard-coded rules to return desired responses
+      if fix_request.HasMacAddress("good_mac_address"):
+        send_response(self, 200, GOOD_JSON_RESPONSE)
+      elif fix_request.HasMacAddress("no_location_mac_address"):
+        send_response(self, 200, NO_LOCATION_JSON_RESPONSE)
+      elif fix_request.HasCellId(88):
+        send_response(self, 400, "Mock malformed request error")
+      else:
+        send_response(self, 400, "Unexpected request")
+    else:
+      send_response(self, 400, "Empty request")
+  else:
+    send_response(self, 400, "Content-Type should be application/json")
 else:
-  send_response(self, 405, "Please provide a POST method.")
+  send_response(self, 405, "Request must be HTTP POST.")

Reply via email to