Yes. I've just created PR #3949 .
No.
To use destructured response method from h in route handler.
server.route({
method: 'POST',
path: '/',
handler: (req, { response }) => {
return response({
message: 'Created',
}).code(201);
},
});
Debug: internal, implementation, error
TypeError: Cannot read property 'request' of undefined
at response (. . . ./node_modules/@hapi/hapi/lib/toolkit.js:177:43)
Use response without h;
The toolkit is a class with prototype methods. You can't deconstruct it. Allowing you to means creating new functions on every toolkit generation instead of reusing the prototype methods. Not going to happen.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
The toolkit is a class with prototype methods. You can't deconstruct it. Allowing you to means creating new functions on every toolkit generation instead of reusing the prototype methods. Not going to happen.