Fix Batch issues. Fixes issue #41.
diff --git a/apiclient/discovery.py b/apiclient/discovery.py
index 4f76ca0..9344392 100644
--- a/apiclient/discovery.py
+++ b/apiclient/discovery.py
@@ -343,7 +343,7 @@
           'location': 'query'
           }
 
-    if httpMethod in ['PUT', 'POST', 'PATCH']:
+    if httpMethod in ['PUT', 'POST', 'PATCH'] and 'request' in methodDesc:
       methodDesc['parameters']['body'] = {
           'description': 'The request body.',
           'type': 'object',
@@ -353,12 +353,13 @@
         methodDesc['parameters']['body'].update(methodDesc['request'])
       else:
         methodDesc['parameters']['body']['type'] = 'object'
-      if 'mediaUpload' in methodDesc:
-        methodDesc['parameters']['media_body'] = {
-            'description': 'The filename of the media request body.',
-            'type': 'string',
-            'required': False,
-            }
+    if 'mediaUpload' in methodDesc:
+      methodDesc['parameters']['media_body'] = {
+          'description': 'The filename of the media request body.',
+          'type': 'string',
+          'required': False,
+          }
+      if 'body' in methodDesc['parameters']:
         methodDesc['parameters']['body']['required'] = False
 
     argmap = {} # Map from method parameter name to query parameter name
diff --git a/apiclient/errors.py b/apiclient/errors.py
index 0d420df..fca3960 100644
--- a/apiclient/errors.py
+++ b/apiclient/errors.py
@@ -91,9 +91,18 @@
   pass
 
 
-class BatchError(Error):
+class BatchError(HttpError):
   """Error occured during batch operations."""
-  pass
+
+  def __init__(self, reason, resp=None, content=None):
+    self.resp = resp
+    self.content = content
+    self.reason = reason
+
+  def __repr__(self):
+      return '<BatchError %s "%s">' % (self.resp.status, self.reason)
+
+  __str__ = __repr__
 
 
 class UnexpectedMethodError(Error):
diff --git a/apiclient/http.py b/apiclient/http.py
index 8ea5c73..6de443e 100644
--- a/apiclient/http.py
+++ b/apiclient/http.py
@@ -491,7 +491,7 @@
         (None, None, parsed.path, parsed.params, parsed.query, None)
         )
     status_line = request.method + ' ' + request_line + ' HTTP/1.1\n'
-    major, minor = request.headers.get('content-type', 'text/plain').split('/')
+    major, minor = request.headers.get('content-type', 'application/json').split('/')
     msg = MIMENonMultipart(major, minor)
     headers = request.headers.copy()
 
@@ -506,6 +506,7 @@
 
     if request.body is not None:
       msg.set_payload(request.body)
+      msg['content-length'] = str(len(request.body))
 
     body = msg.as_string(False)
     # Strip off the \n\n that the MIME lib tacks onto the end of the payload.
@@ -525,7 +526,7 @@
     """
     # Strip off the status line
     status_line, payload = payload.split('\n', 1)
-    protocol, status, reason = status_line.split(' ')
+    protocol, status, reason = status_line.split(' ', 2)
 
     # Parse the rest of the response
     parser = FeedParser()
@@ -604,6 +605,7 @@
     Raises:
       apiclient.errors.HttpError if the response was not a 2xx.
       httplib2.Error if a transport error has occured.
+      apiclient.errors.BatchError if the response is the wrong format.
     """
     if http is None:
       for request_id in self._order:
@@ -649,14 +651,15 @@
 
     # Prepend with a content-type header so FeedParser can handle it.
     header = 'Content-Type: %s\r\n\r\n' % resp['content-type']
-    content = header + content
+    for_parser = header + content
 
     parser = FeedParser()
-    parser.feed(content)
+    parser.feed(for_parser)
     respRoot = parser.close()
 
     if not respRoot.is_multipart():
-      raise BatchError("Response not in multipart/mixed format.")
+      raise BatchError("Response not in multipart/mixed format.", resp,
+          content)
 
     parts = respRoot.get_payload()
     for part in parts: