diff --git a/gdocs.js b/gdocs.js index 4e8048f0a430..3f5f12fe96c6 100755 --- a/gdocs.js +++ b/gdocs.js @@ -85,6 +85,8 @@ function download(collection, name, url) { data = data + '\n'; + //this should be a bug in Google Doc API, hence need to remove this once the bug is fixed + data = data.replace(/\n\n/g, '\n'); fs.writeFileSync('docs/content/' + collection + '/' + name, reflow(data, 100)); } ); diff --git a/src/Browser.js b/src/Browser.js index 052ea59f2062..0856d260637f 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -14,8 +14,9 @@ var XHR_HEADERS = { "Accept": "application/json, text/plain, */*", "X-Requested-With": "XMLHttpRequest" }, - POST: {'Content-Type': 'application/x-www-form-urlencoded'} + NON_GET: {'Content-Type': 'application/x-www-form-urlencoded'} }; +XHR_HEADERS.POST = XHR_HEADERS.PUT = XHR_HEADERS.DELETE = XHR_HEADERS.NON_GET /** * @private diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js index 08756904f61d..c561dbc62cde 100644 --- a/test/BrowserSpecs.js +++ b/test/BrowserSpecs.js @@ -144,11 +144,23 @@ describe('browser', function(){ expect(xhr.headers['Content-Type']).not.toBeDefined(); }); - it('should set Content-type header for POST requests', function() { - browser.xhr('POST', 'URL', 'POST-DATA', function(c, r) {}); + describe('non GET requests', function(){ + afterEach(function() { + expect(xhr.headers['Content-Type']).toBeDefined(); + expect(xhr.headers['Content-Type']).toEqual('application/x-www-form-urlencoded'); + }); + + it('should set Content-type header for POST requests', function() { + browser.xhr('POST', 'URL', 'POST-DATA', function(c, r) {}); + }); - expect(xhr.headers['Content-Type']).toBeDefined(); - expect(xhr.headers['Content-Type']).toEqual('application/x-www-form-urlencoded'); + it('should set Content-type header for PUT requests', function() { + browser.xhr('PUT', 'URL', 'POST-DATA', function(c, r) {}); + }); + + it('should set Content-type header for DELETE requests', function() { + browser.xhr('PUT', 'URL', 'POST-DATA', function(c, r) {}); + }); }); it('should set default headers for custom methods', function() {