Skip to content

Commit

Permalink
fix: double decoding of json
Browse files Browse the repository at this point in the history
  • Loading branch information
manchuck committed Jan 22, 2024
1 parent 4778c07 commit 42217d8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ Client.prototype.listBroadcasts = function listBroadcasts(queryString, cb) {
url:url,
method: 'GET',
headers: this.generateHeaders(),
callback: (err, response ) => {
const items = response ? JSON.parse(response) : response;

callback: (err, items) => {
cb(
err,
items?.items.map((item) => new Broadcast(Client, JSON.stringify(item))),
Expand Down Expand Up @@ -410,8 +408,7 @@ Client.prototype.listStreams = function listStreams(sessionId, cb) {
url: url,
method: 'GET',
headers: this.generateHeaders(),
callback: (err, response) => {
const body = response ? JSON.parse(response) : response;
callback: (err, body) => {
cb(err, body?.items.map((stream) => new Stream(JSON.stringify(stream))))
},
});
Expand Down

0 comments on commit 42217d8

Please sign in to comment.