File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -1120,10 +1120,6 @@ def _serialize_request(self, request):
11201120 g .flatten (msg , unixfrom = False )
11211121 body = fp .getvalue ()
11221122
1123- # Strip off the \n\n that the MIME lib tacks onto the end of the payload.
1124- if request .body is None :
1125- body = body [:- 2 ]
1126-
11271123 return status_line + body
11281124
11291125 def _deserialize_response (self , payload ):
Original file line number Diff line number Diff line change @@ -453,6 +453,11 @@ def test_media_io_base_download_retries_5xx(self):
453453Host: www.googleapis.com
454454content-length: 0\r \n \r \n """
455455
456+ NO_BODY_EXPECTED_GET = """GET /someapi/v1/collection/?foo=bar HTTP/1.1
457+ Content-Type: application/json
458+ MIME-Version: 1.0
459+ Host: www.googleapis.com\r \n \r \n """
460+
456461
457462RESPONSE = """HTTP/1.1 200 OK
458463Content-Type: application/json
@@ -711,6 +716,20 @@ def test_serialize_request_no_body(self):
711716 s = batch ._serialize_request (request ).splitlines ()
712717 self .assertEqual (NO_BODY_EXPECTED .splitlines (), s )
713718
719+ def test_serialize_get_request_no_body (self ):
720+ batch = BatchHttpRequest ()
721+ request = HttpRequest (
722+ None ,
723+ None ,
724+ 'https://www.googleapis.com/someapi/v1/collection/?foo=bar' ,
725+ method = 'GET' ,
726+ body = None ,
727+ headers = {'content-type' : 'application/json' },
728+ methodId = None ,
729+ resumable = None )
730+ s = batch ._serialize_request (request ).splitlines ()
731+ self .assertEqual (NO_BODY_EXPECTED_GET .splitlines (), s )
732+
714733 def test_deserialize_response (self ):
715734 batch = BatchHttpRequest ()
716735 resp , content = batch ._deserialize_response (RESPONSE )
You can’t perform that action at this time.
0 commit comments