From 938849bb97b76e53c75c1a24d4474c3f5b408ebb Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sun, 22 Dec 2019 09:57:41 +0100 Subject: [PATCH] adapters/application: Pass `User-Agent` header to backend in fastboot mode The backend was complaining about only accepting requests with a `User-Agent` header, so let's give it such a header ;) --- app/adapters/application.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/adapters/application.js b/app/adapters/application.js index f6e373f893..c9dcca7240 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -1,5 +1,17 @@ import RESTAdapter from '@ember-data/adapter/rest'; +import { inject as service } from '@ember/service'; +import { computed } from '@ember/object'; export default RESTAdapter.extend({ + fastboot: service(), + namespace: 'api/v1', + + headers: computed('fastboot.{isFastBoot,request.headers}', function() { + if (this.fastboot.isFastBoot) { + return { 'User-Agent': this.fastboot.request.headers.get('User-Agent') }; + } + + return {}; + }), });