Skip to content

Commit

Permalink
Merge pull request #191 from particle-iot/bug/sc-132018/device-events…
Browse files Browse the repository at this point in the history
…-console-page-is-not-working

fix: [sc-132018] Device events console page is not working in Firefox
  • Loading branch information
monkbroc authored Nov 5, 2024
2 parents ae123ab + d73da54 commit 808190f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/EventStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class EventStream extends EventEmitter {

const isSecure = protocol === 'https:';
const requestor = isSecure ? https : http;
const nonce = global.performance ? global.performance.now() : 0;
const req = requestor.request({
hostname,
protocol,
path,
// Firefox has issues making multiple fetch requests with the same parameters so add a nonce
path: `${path}?nonce=${nonce}`,
headers: {
'Authorization': `Bearer ${this.token}`
},
Expand Down
2 changes: 1 addition & 1 deletion test/EventStream.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('EventStream', () => {
expect(http.request).to.have.been.calledWith({
hostname: 'hostname',
protocol: 'http:',
path: '/path',
path: '/path?nonce=0',
headers: {
'Authorization': 'Bearer token'
},
Expand Down

0 comments on commit 808190f

Please sign in to comment.