Skip to content

Commit

Permalink
feat (test): aborted request handling in reply.send
Browse files Browse the repository at this point in the history
  • Loading branch information
Allain55 committed Jan 24, 2022
1 parent 172c3ed commit 3a628f5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/internals/reply.test.js
Expand Up @@ -106,6 +106,19 @@ test('reply.serializer should set a custom serializer', t => {
t.equal(reply[kReplySerializer], 'serializer')
})

test('reply.send handles aborted requests', t => {
t.plan(1)
const response = {
setHeader: () => {},
hasHeader: () => false,
getHeader: () => undefined,
writeHead: () => {},
end: () => {}
}
const reply = new Reply(response, { raw: { aborted: true } })
t.equal(reply.send('hello'), reply)
})

test('reply.serializer should support running preSerialization hooks', t => {
t.plan(3)
const fastify = require('../..')()
Expand Down

0 comments on commit 3a628f5

Please sign in to comment.