From e6305c0568449bea0988498116f177809d6f80a3 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 11 Aug 2021 11:25:39 -0400 Subject: [PATCH] another fix to allow 202 response to PUT --- lib/rest/rest-entity.js | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rest/rest-entity.js b/lib/rest/rest-entity.js index 7d976c8..6a05a78 100644 --- a/lib/rest/rest-entity.js +++ b/lib/rest/rest-entity.js @@ -20,7 +20,9 @@ class RestEntity { console.log({sid, opts}); const res = await this.put(`Accounts/${this.accountSid}/${this.name}/${sid}`, opts); if (res.statusCode === 404) throw new Error(`${this.name}.update: sid ${sid} not found`); - if (res.statusCode !== 204) throw new Error(`${this.name}.update: unexpected status code ${res.statusCode}`); + if (![202, 204].includes(res.statusCode)) { + throw new Error(`${this.name}.update: unexpected status code ${res.statusCode}`); + } } async list(opts) { diff --git a/package.json b/package.json index 53ed169..6f6b082 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jambonz/node-client", - "version": "0.2.2", + "version": "0.2.3", "description": "", "main": "lib/index.js", "scripts": {