Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ function fastbootExpressMiddleware(distPath, options) {
responseBody.then(body => {
let headers = result.headers;
let statusMessage = result.error ? 'NOT OK ' : 'OK ';

for (var pair of headers.entries()) {
res.set(pair[0], pair[1]);
}

if (result.error) {
log("RESILIENT MODE CAUGHT:", result.error.stack);
next(result.error);
}

log(result.statusCode, statusMessage + path);
res.status(result.statusCode);

Expand All @@ -55,6 +55,7 @@ function fastbootExpressMiddleware(distPath, options) {
} else if (result.error) {
res.send(body[0]);
} else {
res.type('html');
body.forEach(chunk => res.write(chunk));
res.end();
}
Expand Down
1 change: 1 addition & 0 deletions test/middleware-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe("FastBoot", function() {
.then(() => server.request('/', { resolveWithFullResponse: true }))
.then(({ body, _, headers }) => {
expect(headers['transfer-encoding']).to.eq('chunked');
expect(headers['content-type']).to.eq('text/html; charset=utf-8');
expect(body).to.match(/Welcome to Ember/);
});
});
Expand Down