Skip to content

Commit 808190f

Browse files
authored
Merge pull request #191 from particle-iot/bug/sc-132018/device-events-console-page-is-not-working
fix: [sc-132018] Device events console page is not working in Firefox
2 parents ae123ab + d73da54 commit 808190f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/EventStream.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ class EventStream extends EventEmitter {
2626

2727
const isSecure = protocol === 'https:';
2828
const requestor = isSecure ? https : http;
29+
const nonce = global.performance ? global.performance.now() : 0;
2930
const req = requestor.request({
3031
hostname,
3132
protocol,
32-
path,
33+
// Firefox has issues making multiple fetch requests with the same parameters so add a nonce
34+
path: `${path}?nonce=${nonce}`,
3335
headers: {
3436
'Authorization': `Bearer ${this.token}`
3537
},

test/EventStream.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('EventStream', () => {
4949
expect(http.request).to.have.been.calledWith({
5050
hostname: 'hostname',
5151
protocol: 'http:',
52-
path: '/path',
52+
path: '/path?nonce=0',
5353
headers: {
5454
'Authorization': 'Bearer token'
5555
},

0 commit comments

Comments
 (0)