提交 2c28e122 编写于 作者: E Eduardo P. Rivero 提交者: Tim Neutkens

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册