Skip to content

Commit

Permalink
Merge b471309 into 5ebd2c4
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Oct 17, 2022
2 parents 5ebd2c4 + b471309 commit c876242
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/option_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ const toUint = (value: Buffer): number => {
}

registerOption('Max-Age', fromUint, toUint)
registerOption('Size2', fromUint, toUint)
registerOption('Size1', fromUint, toUint)

// Content-Format and Accept options registration
const formatsString = {}
Expand Down
28 changes: 28 additions & 0 deletions test/end-to-end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,34 @@ describe('end-to-end', function () {
})
})

it('should allow option \'Size2\'', function (done) {
const req = request(`coap://localhost:${port}`)
const value = 520

req.setOption('Size2', value)
req.end()

server.once('request', (req) => {
expect(req.options[0].name).to.equal('Size2')
expect(req.options[0].value).to.equal(value)
done()
})
})

it('should allow option \'Size1\'', function (done) {
const req = request(`coap://localhost:${port}`)
const value = 9001

req.setOption('Size1', value)
req.end()

server.once('request', (req) => {
expect(req.options[0].name).to.equal('Size1')
expect(req.options[0].value).to.equal(value)
done()
})
})

it('should provide a writeHead() method', function (done) {
const req = request(`coap://localhost:${port}`)
req.end()
Expand Down

0 comments on commit c876242

Please sign in to comment.