Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Double line#to#single #390

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gdocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
);
Expand Down
3 changes: 2 additions & 1 deletion src/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions test/BrowserSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down