Commit 2c28e122 authored by Eduardo P. Rivero's avatar Eduardo P. Rivero Committed by Tim Neutkens

feat(web): Passing actual status code instead 200 (#7735)

parent 90280c86
......@@ -5,19 +5,21 @@ const nextHandlerWrapper = app => {
return h.close
}
}
const defaultHandlerWrapper = app => async ({ raw: { req, res }, url }) => {
const defaultHandlerWrapper = app => async ({ raw: { req, res }, url }, h) => {
const { pathname, query } = url
return app.renderToHTML(req, res, pathname, query)
const html = await app.renderToHTML(req, res, pathname, query)
return h.response(html).code(res.statusCode)
}
const pathWrapper = (app, pathName, opts) => async ({ raw, query, params }) => {
return app.renderToHTML(
const pathWrapper = (app, pathName, opts) => async ({ raw, query, params }, h) => {
const html = await app.renderToHTML(
raw.req,
raw.res,
pathName,
{ ...query, ...params },
opts
)
return h.response(html).code(raw.res.statusCode)
}
module.exports = { pathWrapper, defaultHandlerWrapper, nextHandlerWrapper }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment