Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion packages/fastboot/src/ember-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class EmberApp {
let bootOptions = buildBootOptions(shouldRender);
let fastbootInfo = new FastBootInfo(req, res, {
hostWhitelist: this.hostWhitelist,
metadata: options.metadata,
metadata: options.metadata || {},
});

let doc = bootOptions.document;
Expand Down
1 change: 1 addition & 0 deletions test-packages/basic-app/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Router.map(function() {
this.route('async-content');
this.route('echo-request-headers');
this.route('return-status-code-418');
this.route('metadata');
});
12 changes: 12 additions & 0 deletions test-packages/basic-app/app/routes/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
fastboot: service(),

model() {
if (this.get('fastboot.isFastBoot') && this.fastboot.metadata) {
return 'test fastboot metadata';
}
},
});
1 change: 1 addition & 0 deletions test-packages/basic-app/app/templates/metadata.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{this.model}}
16 changes: 16 additions & 0 deletions test-packages/integration-tests/test/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,20 @@ describe("FastBoot", function() {
.then((r) => r.html());
expect(html).to.match(/foo from sandbox: 5/);
});

it("does not break the render with empty metadata", async function() {
const fastboot = new FastBoot({
distPath: await buildDist("basic-app"),
});

return fastboot
.visit("/metadata", {
request: dummyRequest(),
response: dummyResponse(),
})
.then((r) => r.html())
.then((html) => {
expect(html).to.match(/test fastboot metadata/);
});
});
});