Skip to content

Commit

Permalink
fix: allow app to control useStream option
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Apr 9, 2020
1 parent ef82cfd commit d20e7e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/subapp-server/lib/register-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ module.exports = function registerRoutes({ routes, topOpts, server }) {

const routeHandler = ReactWebapp.makeRouteHandler(routeOptions);

const useStream = routeOptions.useStream !== false;

const handler = async (request, h) => {
try {
const context = await routeHandler({
content: { html: "", status: HttpStatusCodes.OK, useStream: false },
content: { html: "", status: HttpStatusCodes.OK, useStream },
mode: "",
request
});
Expand All @@ -50,10 +52,7 @@ module.exports = function registerRoutes({ routes, topOpts, server }) {
}

if (status === undefined) {
return h
.response(data)
.type("text/html; charset=UTF-8")
.code(HttpStatusCodes.OK);
return h.response(data).type("text/html; charset=UTF-8").code(HttpStatusCodes.OK);
} else if (HttpStatus.redirect[status]) {
return h.redirect(data.path);
} else if (HttpStatus.displayHtml[status]) {
Expand Down
5 changes: 5 additions & 0 deletions packages/subapp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,10 @@
"functions": 0,
"lines": 0,
"cache": true
},
"prettier": {
"printWidth": 100,
"trailingComma": "none",
"arrowParens": "avoid"
}
}

0 comments on commit d20e7e2

Please sign in to comment.