mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 12:43:18 +08:00
Fix POST status code, thanks to @lagoLast
This commit is contained in:
@ -156,7 +156,7 @@ module.exports = function(source) {
|
||||
var resource = db(req.params.resource)
|
||||
.insert(req.body)
|
||||
|
||||
res.jsonp(resource)
|
||||
res.status(201).jsonp(resource)
|
||||
}
|
||||
|
||||
// PUT /:resource/:id
|
||||
|
@ -208,7 +208,7 @@ describe('Server', function() {
|
||||
.send({body: 'foo', booleanValue: 'true', integerValue: '1'})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect({id: 3, body: 'foo', booleanValue: true, integerValue: 1})
|
||||
.expect(200)
|
||||
.expect(201)
|
||||
.end(function(err, res) {
|
||||
if (err) return done(err)
|
||||
assert.equal(db.posts.length, 3)
|
||||
@ -222,7 +222,7 @@ describe('Server', function() {
|
||||
.post('/refs')
|
||||
.send({url: 'http://foo.com', postId: '1'})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.expect(201)
|
||||
.end(function(err, res) {
|
||||
if (err) return done(err)
|
||||
assert.equal(db.refs.length, 2)
|
||||
|
Reference in New Issue
Block a user