@@ -176,6 +176,10 @@ def request(self, *args, **kwargs):
176
176
def datafile (filename ):
177
177
return os .path .join (DATA_DIR , filename )
178
178
179
+ def _postproc_none (* kwargs ):
180
+ pass
181
+
182
+
179
183
class TestUserAgent (unittest .TestCase ):
180
184
181
185
def test_set_user_agent (self ):
@@ -240,16 +244,12 @@ def test_media_inmemory_upload(self):
240
244
self .assertEqual (6 , media .size ())
241
245
242
246
def test_http_request_to_from_json (self ):
243
-
244
- def _postproc (* kwargs ):
245
- pass
246
-
247
247
http = build_http ()
248
248
media_upload = MediaFileUpload (
249
249
datafile ('small.png' ), chunksize = 500 , resumable = True )
250
250
req = HttpRequest (
251
251
http ,
252
- _postproc ,
252
+ _postproc_none ,
253
253
'http://example.com' ,
254
254
method = 'POST' ,
255
255
body = '{}' ,
@@ -258,7 +258,7 @@ def _postproc(*kwargs):
258
258
resumable = media_upload )
259
259
260
260
json = req .to_json ()
261
- new_req = HttpRequest .from_json (json , http , _postproc )
261
+ new_req = HttpRequest .from_json (json , http , _postproc_none )
262
262
263
263
self .assertEqual ({'content-type' :
264
264
'multipart/related; boundary="---flubber"' },
@@ -808,6 +808,20 @@ def test_unicode(self):
808
808
self .assertEqual (method , http .method )
809
809
self .assertEqual (str , type (http .method ))
810
810
811
+ def test_empty_content_type (self ):
812
+ """Test for #284"""
813
+ http = HttpMock (None , headers = {'status' : 200 })
814
+ uri = u'https://www.googleapis.com/someapi/v1/upload/?foo=bar'
815
+ method = u'POST'
816
+ request = HttpRequest (
817
+ http ,
818
+ _postproc_none ,
819
+ uri ,
820
+ method = method ,
821
+ headers = {'content-type' : '' })
822
+ request .execute ()
823
+ self .assertEqual ('' , http .headers .get ('content-type' ))
824
+
811
825
def test_no_retry_connection_errors (self ):
812
826
model = JsonModel ()
813
827
request = HttpRequest (
0 commit comments