I was trying to implement a reply helper through plugin in hapi. The plugin passes the request
and reply
object to a helper class. But I think calling reply.continue()
to return control to hapi changes the reply object. My plugin
const replyPlugin = {
register: function registerReplyHelper(server, options, next) {
server.ext('onRequest', (request, reply) => {
replyHelper.setRequest(request);
replyHelper.setReply(reply);
reply.continue();
});
next();
}
};
Then I'm calling reply()
from the helper class.
this.reply(data);
Although this line was executed the request was not ended with response, rather it was stuck. I've tried moving the setReply(reply)
statement to handler and it worked, but that's not the way I wanted it implemented. Is there any way to make the former implementation work?
via shawon191
No comments:
Post a Comment