Fix gtaskqueue to not pass in body={}. Also fix bug with 0 length POSTs. Reviewed in http://codereview.appspot.com/5694067/.

This commit is contained in:
Joe Gregorio
2012-02-24 09:37:00 -05:00
parent fa8cd9fa43
commit 884e2b2101
4 changed files with 5 additions and 4 deletions

View File

@@ -379,6 +379,8 @@ class HttpRequest(object):
_, body = self.next_chunk(http)
return body
else:
if 'content-length' not in self.headers:
self.headers['content-length'] = str(self.body_size)
resp, content = http.request(self.uri, self.method,
body=self.body,
headers=self.headers)

View File

@@ -86,8 +86,7 @@ class LeaseTaskCommand(GoogleTaskCommand):
return task_api.lease(project=flag_values.project_name,
taskqueue=flag_values.taskqueue_name,
leaseSecs=flag_values.lease_secs,
numTasks=flag_values.num_tasks,
body={})
numTasks=flag_values.num_tasks)
def print_result(self, result):
"""Override to optionally strip the payload since it can be long."""

View File

@@ -21,10 +21,10 @@
import os
import sys
import urlparse
from apiclient.anyjson import simplejson as json
from apiclient.discovery import build
from apiclient.errors import HttpError
import httplib2
from oauth2client.anyjson import simplejson as json
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run

View File

@@ -27,8 +27,8 @@ import urlparse
from apiclient.discovery import build
from apiclient.errors import HttpError
from apiclient.anyjson import simplejson as json
import httplib2
from oauth2client.anyjson import simplejson as json
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run