Browse files

[minor] Content-Type is not required by journey

  • Loading branch information...
1 parent 499bd4a commit 188e293e8a45cdc48bf073ae36d43c634268b541 @indexzero committed Feb 1, 2011
Showing with 25 additions and 25 deletions.
  1. +5 −5 lib/01routing/service.js
  2. +10 −10 lib/02couchdb/service.js
  3. +10 −10 lib/03authentication/service.js
View
10 lib/01routing/service.js
@@ -18,35 +18,35 @@ exports.createRouter = function () {
// LIST: GET to /bookmarks lists all bookmarks
//
this.get().bind(function (res) {
- res.send(501, { 'Content-Type': 'application/json'}, { action: 'list' });
+ res.send(501, {}, { action: 'list' });
});
//
// SHOW: GET to /bookmarks/:id shows the details of a specific bookmark
//
this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
- res.send(501, { 'Content-Type': 'application/json'}, { action: 'show' });
+ res.send(501, {}, { action: 'show' });
});
//
// CREATE: POST to /bookmarks creates a new bookmark
//
this.post().bind(function (res, bookmark) {
- res.send(501, { 'Content-Type': 'application/json'}, { action: 'create' });
+ res.send(501, {}, { action: 'create' });
});
//
// UPDATE: PUT to /bookmarks updates an existing bookmark
//
this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, bookmark) {
- res.send(501, { 'Content-Type': 'application/json'}, { action: 'update' });
+ res.send(501, {}, { action: 'update' });
});
//
// DELETE: DELETE to /bookmarks/:id deletes a specific bookmark
//
this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
- res.send(501, { 'Content-Type': 'application/json'}, { action: 'delete' });
+ res.send(501, {}, { action: 'delete' });
});
});
}, { strict: false });
View
20 lib/02couchdb/service.js
@@ -22,10 +22,10 @@ exports.createRouter = function (resource) {
this.get().bind(function (res) {
resource.list(function (err, bookmarks) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmarks: bookmarks });
+ res.send(200, {}, { bookmarks: bookmarks });
});
});
@@ -35,10 +35,10 @@ exports.createRouter = function (resource) {
this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
resource.show(id, function (err, bookmark) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmark: bookmark });
+ res.send(200, {}, { bookmark: bookmark });
});
});
@@ -48,10 +48,10 @@ exports.createRouter = function (resource) {
this.post().bind(function (res, bookmark) {
resource.create(bookmark, function (err, result) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmark: result });
+ res.send(200, {}, { bookmark: result });
});
});
@@ -61,10 +61,10 @@ exports.createRouter = function (resource) {
this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, id, bookmark) {
resource.update(id, bookmark, function (err, updated) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { updated: updated });
+ res.send(200, {}, { updated: updated });
});
});
@@ -74,10 +74,10 @@ exports.createRouter = function (resource) {
this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
resource.destroy(id, function (err, destroyed) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { destroyed: destroyed });
+ res.send(200, {}, { destroyed: destroyed });
});
});
});
View
20 lib/03authentication/service.js
@@ -29,10 +29,10 @@ exports.createRouter = function (resource) {
this.get().bind(function (res) {
resource.list(function (err, bookmarks) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmarks: bookmarks });
+ res.send(200, {}, { bookmarks: bookmarks });
});
});
@@ -42,10 +42,10 @@ exports.createRouter = function (resource) {
this.get(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
resource.show(id, function (err, bookmark) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmark: bookmark });
+ res.send(200, {}, { bookmark: bookmark });
});
});
@@ -55,10 +55,10 @@ exports.createRouter = function (resource) {
this.post().bind(function (res, bookmark) {
resource.create(bookmark, function (err, result) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { bookmark: result });
+ res.send(200, {}, { bookmark: result });
});
});
@@ -68,10 +68,10 @@ exports.createRouter = function (resource) {
this.put(/\/([\w|\d|\-|\_]+)/).bind(function (res, id, bookmark) {
resource.update(id, bookmark, function (err, updated) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { updated: updated });
+ res.send(200, {}, { updated: updated });
});
});
@@ -81,10 +81,10 @@ exports.createRouter = function (resource) {
this.del(/\/([\w|\d|\-|\_]+)/).bind(function (res, id) {
resource.destroy(id, function (err, destroyed) {
if (err) {
- return res.send(500, { 'Content-Type': 'application/json' }, { error: err.error });
+ return res.send(500, {}, { error: err.error });
}
- res.send(200, { 'Content-Type': 'application/json' }, { destroyed: destroyed });
+ res.send(200, {}, { destroyed: destroyed });
});
});
});

0 comments on commit 188e293

Please sign in to comment.