Skip to content

Commit

Permalink
fix: use reply.hijack() or reply.sent (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Aug 29, 2022
1 parent f935349 commit 69788f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fastify
fastify.next(`${process.env.BASE_PATH || ''}/_next/*`, (app, req, reply) => {
// your code
app.getRequestHandler()(req.raw, reply.raw).then(() => {
reply.sent = true
reply.hijack()
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function fastifyNext (fastify, options, next) {

return handleNextRequests(req.raw, reply.raw)
.then(() => {
reply.sent = true
reply.hijack()
})
}
}
Expand All @@ -88,7 +88,7 @@ function fastifyNext (fastify, options, next) {

await app.render(request.raw, reply.raw, path, request.query)

reply.sent = true
reply.hijack()
}

async function renderError (err) {
Expand All @@ -102,7 +102,7 @@ function fastifyNext (fastify, options, next) {

await app.renderError(err, request.raw, reply.raw, request.url, request.query)

reply.sent = true
reply.hijack()
}
}

Expand Down
2 changes: 1 addition & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ app
return nextApp
.getRequestHandler()(req.raw, reply.raw)
.then(() => {
reply.sent = true;
reply.hijack()
});
});

Expand Down

0 comments on commit 69788f2

Please sign in to comment.