feat: Added handler option.#465
Conversation
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
There was a problem hiding this comment.
What is it different from using reply.fromParameters in preHandler ?
const { url, options } = reply.fromParameters('/updated', { ...request.params, serverId: 42 })
reply.from(url, options)or onResponse ?
reply.from(source, {
onResponse(request, reply, res) => {
reply.removeHeader('content-length');
reply.send('New body of different length');
}
})|
@climba03003 Sometimes I want to totally skip reply.from but take advantage of all other goodies. Do you see a different way to do that? |
That is exactly why you need to use Bypassing the |
|
I use fromParameters. |
Summary
Adds a new
handleroption to customize HTTP proxy response handling while preserving the existing default behavior.Changes
opts.handlersupport inindex.js.reply.from(dest, options)when no custom handler is provided.handler, when provided, is a function.reply.from(dest, options)handleroption inREADME.md.Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct