Skip to content

Commit

Permalink
Upgraded coap-packet to work with Copper. Default code for resp is 2.05
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Oct 10, 2013
1 parent 45a8688 commit 6b5e467
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ CoAPServer.prototype._handle = function(packet, rsinfo) {
sender.send(buf, !packet.ack)
})

response.statusCode = '2.00'
response.statusCode = '2.05'

sender.on('error', response.emit.bind(response, 'error'))

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"sinon": "~1.7.3"
},
"dependencies": {
"coap-packet": "~0.1.6",
"coap-packet": "~0.1.7",
"bl": "~0.5.0",
"backoff": "~2.3.0",
"lru-cache": "~2.3.1"
Expand Down
12 changes: 12 additions & 0 deletions test/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ describe('end-to-end', function() {
})
})

it('should return code 2.05 by default', function(done) {
var req = coap.request('coap://localhost:'+port + '/abcd/ef/gh/?foo=bar&beep=bop').end()
req.on('response', function(res) {
expect(res.code).to.eql('2.05')
done()
})

server.on('request', function(req, res) {
res.end('hello')
})
})

describe('formats', function() {
var formats = [ 'text/plain', 'application/link-format',
'application/xml', 'application/octet-stream',
Expand Down

0 comments on commit 6b5e467

Please sign in to comment.