Skip to content

Commit

Permalink
fix status code error
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 14, 2015
1 parent 2e1079a commit 67dcb4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/coap.js
Expand Up @@ -8,7 +8,7 @@ module.exports = function (app) {
var deviceRex = /^\/(.*)\/(.*)\?/;

var other = function () {
res.code = '4.00';
res.code = '4.05';
res.end(JSON.stringify({method: 'not support'}));
};

Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = function (app) {

var handPut = function () {
if (!(deviceRex.test(req.url))) {
res.code = '4.03';
res.code = '4.04';
res.end(JSON.stringify({topic: 'no exist'}));
}
var successCB = function (user) {
Expand All @@ -64,7 +64,7 @@ module.exports = function (app) {
payload[deviceID] = deviceRex.exec(req.url)[2];

db.update(payload);
res.code = '2.00';
res.code = '2.01';
res.end(JSON.stringify({method: 'PUT'}));
};

Expand Down
4 changes: 2 additions & 2 deletions test/server/coap_spec.js
Expand Up @@ -53,7 +53,7 @@ describe('CoAP Services Test', function () {
var req = coap.request('coap://localhost/hello');

req.on('response', function (res) {
if (res.code === '4.00') {
if (res.code === '4.05') {
done();
}
});
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('CoAP Services Test', function () {
var req = request({hostname: 'localhost', port: 5683, pathname: 'device/2', method: 'PUT', query: 'phodal:phodal'});
req.write(JSON.stringify({topic: "this is device UPDATE"}));
req.on('response', function (res) {
if (res.code === '2.00') {
if (res.code === '2.01') {
done();
}
});
Expand Down

0 comments on commit 67dcb4e

Please sign in to comment.