Skip to content

Commit

Permalink
Merge pull request #19 from jambonz/fix/retrieve_call
Browse files Browse the repository at this point in the history
fix retrieve call cdr by sid return null
  • Loading branch information
davehorton authored Nov 14, 2024
2 parents 60a4d3c + d3d4697 commit 43233c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rest/rest-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class RestEntity {
async retrieve(sid) {
try {
const res = await this.get(`Accounts/${this.accountSid}/${this.name}/${sid}`);
return res.length > 0 ? res[0] : null;
//get call by sid will return call cdr as a object and not an array
return res;
} catch (err) {
if (err.statusCode === 404) throw new Error(`${this.name}.retrieve: sid ${sid} not found`);
if (err.statusCode !== 204) throw new Error(`${this.name}.retrieve: unexpected status code ${err.statusCode}`);
Expand Down

0 comments on commit 43233c4

Please sign in to comment.