Skip to content

Commit 3df0a2f

Browse files
committed
Simplify headers
1 parent 0030fb6 commit 3df0a2f

2 files changed

Lines changed: 8 additions & 23 deletions

File tree

lib/data.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ File = (function(superClass) {
3939

4040
File.prototype.put = function(content, callback) {
4141
var headers;
42-
headers = {
43-
'Content-Type': null
44-
};
42+
headers = {};
4543
return this.client.req('/v1/data/' + this.data_path, 'PUT', content, headers, callback);
4644
};
4745

@@ -78,25 +76,22 @@ File = (function(superClass) {
7876
File.prototype.getString = function(callback) {
7977
var headers;
8078
headers = {
81-
'Accept': 'text/plain',
82-
'Content-Type': 'text/plain'
79+
'Accept': 'text/plain'
8380
};
8481
return this.client.req('/v1/data/' + this.data_path, 'GET', '', headers, callback);
8582
};
8683

8784
File.prototype.getJson = function(callback) {
8885
var headers;
8986
headers = {
90-
'Accept': 'application/json',
91-
'Content-Type': 'text/plain'
87+
'Accept': 'application/json'
9288
};
9389
return this.client.req('/v1/data/' + this.data_path, 'GET', '', headers, callback);
9490
};
9591

9692
File.prototype.exists = function(callback) {
9793
var headers;
9894
headers = {
99-
'Content-Type': 'text/plain',
10095
'Accept': 'text/plain'
10196
};
10297
return this.client.req('/v1/data/' + this.data_path, 'HEAD', '', headers, function(response, status) {
@@ -186,9 +181,7 @@ Dir = (function(superClass) {
186181

187182
Dir.prototype.exists = function(callback) {
188183
var headers;
189-
headers = {
190-
'Content-Type': 'text/plain'
191-
};
184+
headers = {};
192185
return this.client.req('/v1/data/' + this.data_path, 'GET', '', headers, function(response, status) {
193186
if (status === 200) {
194187
return callback(true);
@@ -222,9 +215,7 @@ DirListing = (function() {
222215

223216
DirListing.prototype.loadNextPage = function(cb) {
224217
var headers, query;
225-
headers = {
226-
'Content-Type': 'text/plain'
227-
};
218+
headers = {};
228219
query = this.page === null ? '' : "?marker=" + (encodeURIComponent(this.page.marker));
229220
return this.client.req('/v1/data/' + this.data_path + query, 'GET', '', headers, (function(_this) {
230221
return function(response, status) {

src/data.coffee

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class File extends Data
2424

2525
# put any content
2626
put: (content, callback) ->
27-
headers =
28-
'Content-Type': null
27+
headers = {}
2928
@client.req('/v1/data/' + @data_path, 'PUT', content, headers, callback)
3029

3130
# download file
@@ -55,19 +54,16 @@ class File extends Data
5554
getString: (callback) ->
5655
headers =
5756
'Accept': 'text/plain'
58-
'Content-Type': 'text/plain'
5957
@client.req('/v1/data/' + @data_path, 'GET', '', headers, callback)
6058

6159
# deprecated. use `get(function(err, data){ var obj = JSON.parse(data) })`
6260
getJson: (callback) ->
6361
headers =
6462
'Accept': 'application/json'
65-
'Content-Type': 'text/plain'
6663
@client.req('/v1/data/' + @data_path, 'GET', '', headers, callback)
6764

6865
exists: (callback) ->
6966
headers =
70-
'Content-Type': 'text/plain'
7167
'Accept': 'text/plain'
7268
@client.req('/v1/data/' + @data_path, 'HEAD', '', headers, (response, status) ->
7369
if status == 200 then callback(true) else callback(false, status, response)
@@ -119,8 +115,7 @@ class Dir extends Data
119115
callback(err, item)
120116

121117
exists: (callback) ->
122-
headers =
123-
'Content-Type': 'text/plain'
118+
headers = {}
124119
@client.req('/v1/data/' + @data_path, 'GET', '', headers, (response, status) ->
125120
if status == 200 then callback(true) else callback(false, status, response)
126121
)
@@ -143,8 +138,7 @@ class DirListing
143138
@page = null
144139

145140
loadNextPage: (cb) ->
146-
headers =
147-
'Content-Type': 'text/plain'
141+
headers = {}
148142
query = if @page == null then '' else "?marker=#{encodeURIComponent(@page.marker)}"
149143
@client.req('/v1/data/' + @data_path + query, 'GET', '', headers, (response, status) =>
150144
@offset = 0

0 commit comments

Comments
 (0)