Skip to content

Commit 938849b

Browse files
committed
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 ;)
1 parent 03fb901 commit 938849b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/adapters/application.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import RESTAdapter from '@ember-data/adapter/rest';
2+
import { inject as service } from '@ember/service';
3+
import { computed } from '@ember/object';
24

35
export default RESTAdapter.extend({
6+
fastboot: service(),
7+
48
namespace: 'api/v1',
9+
10+
headers: computed('fastboot.{isFastBoot,request.headers}', function() {
11+
if (this.fastboot.isFastBoot) {
12+
return { 'User-Agent': this.fastboot.request.headers.get('User-Agent') };
13+
}
14+
15+
return {};
16+
}),
517
});

0 commit comments

Comments
 (0)