Stop stripping newlines from batch requests
When forming a multipart/mixed HTTP request like the ones created using
the BatchHttpRequest object, the request is supposed to include two
trailing newlines to signify:
1. The termination of the HTTP headers for each wrapped request.
2. The empty body of the wrapped request.
Without this change some implementations of API servers were rejecting
requests generated by this client. Specifically requests which had an
empty wrapped request body.
diff --git a/googleapiclient/http.py b/googleapiclient/http.py
index f63d33e..f272ba8 100644
--- a/googleapiclient/http.py
+++ b/googleapiclient/http.py
@@ -1120,10 +1120,6 @@
g.flatten(msg, unixfrom=False)
body = fp.getvalue()
- # Strip off the \n\n that the MIME lib tacks onto the end of the payload.
- if request.body is None:
- body = body[:-2]
-
return status_line + body
def _deserialize_response(self, payload):