Browse Source

update status code (202 -> 200)

master
Nicolas Massé 8 years ago
parent
commit
56fedde612
  1. 4
      server.js
  2. 4
      test/specs.js

4
server.js

@ -130,7 +130,7 @@ router.delete("/:object/:id",function(req,res){
var thing = config[resource].state.storage[id]; var thing = config[resource].state.storage[id];
delete config[resource].state.storage[id] delete config[resource].state.storage[id]
success(res, 202, thing); success(res, 200, thing);
}); });
// Update a thing // Update a thing
@ -155,7 +155,7 @@ router.put("/:object/:id",function(req,res){
} }
config[resource].state.storage[id] = thing; config[resource].state.storage[id] = thing;
success(res, 202, thing); success(res, 200, thing);
}); });
// //

4
test/specs.js

@ -98,7 +98,7 @@ describe('server.js tests', function () {
.set('Content-Type', "application/json") .set('Content-Type', "application/json")
.send({ name: "Dog", price: 9, id: id }) .send({ name: "Dog", price: 9, id: id })
.expect('Content-Type', /^application[/]json/) .expect('Content-Type', /^application[/]json/)
.expect(202) .expect(200)
.expect((res) => { .expect((res) => {
assert.equal(res.body.name, "Dog", "item.name == dog"); assert.equal(res.body.name, "Dog", "item.name == dog");
assert.equal(res.body.price, 9, "item.price == 9"); assert.equal(res.body.price, 9, "item.price == 9");
@ -125,7 +125,7 @@ describe('server.js tests', function () {
request(server) request(server)
.delete('/things/' + encodeURIComponent(id) + '/') .delete('/things/' + encodeURIComponent(id) + '/')
.expect('Content-Type', /^application[/]json/) .expect('Content-Type', /^application[/]json/)
.expect(202) .expect(200)
.expect((res) => { .expect((res) => {
assert.equal(res.body.name, "Dog", "item.name == dog"); assert.equal(res.body.name, "Dog", "item.name == dog");
assert.equal(res.body.price, 9, "item.price == 9"); assert.equal(res.body.price, 9, "item.price == 9");

Loading…
Cancel
Save