Skip to content

Commit

Permalink
test: add accept and ContentFormat request parameter test
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 6, 2023
1 parent 8621df3 commit 35f3459
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,30 @@ describe('request', function () {
})
})

it('should be able to include accept and Content-Format parameters', function (done) {
const req = request({
port,
accept: 'application/cbor',
contentFormat: 432
})

if (server == null) {
return
}
server.on('message', (msg) => {
const packet = parse(msg)

expect(packet.options[0].name).to.eql('Content-Format')
expect(packet.options[0].value).to.eql(Buffer.of(0x01, 0xb0))
expect(packet.options[1].name).to.eql('Accept')
expect(packet.options[1].value).to.eql(Buffer.of(60))

done()
})

req.end()
})

it('should overwrite the option', function (done) {
const req = request({
port
Expand Down

0 comments on commit 35f3459

Please sign in to comment.