From 241c39818ed3a1bfc5bb2076149d321af7bbc247 Mon Sep 17 00:00:00 2001 From: simonihmig Date: Tue, 20 Oct 2020 15:42:25 +0200 Subject: [PATCH] Add failing test for missing data of FastBoot's package.json Adds accessing `request.host` to `fastboot-app` that reproduces the missing FastBoot package.json data (here `hostWhitelist`) reported in #160. --- test-packages/fastboot-app/app/routes/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test-packages/fastboot-app/app/routes/index.js diff --git a/test-packages/fastboot-app/app/routes/index.js b/test-packages/fastboot-app/app/routes/index.js new file mode 100644 index 000000000..a020a4a4c --- /dev/null +++ b/test-packages/fastboot-app/app/routes/index.js @@ -0,0 +1,14 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class IndexRoute extends Route { + @service + fastboot; + + beforeModel() { + // This is only to to make sure we can correctly access the request's host, which fails if FastBoot's `hostWhitelist` + // is not correctly set up. This is the case when the changes added to /dist/package.json by FastBoot are not correctly + // merged by Embroider. So this serves as a reproduction of https://github.com/embroider-build/embroider/issues/160 + return this.fastboot.isFastBoot ? this.fastboot.request.host : null; + } +}