// this examle uses webhooks, but it could be anything resource that when deleted
// returns a 204 with an empty body
const iveGotALovelyBunchOfWebhooks = await paginator(this.hub.related.webhooks.list);
iveGotALovelyBunchOfWebhooks[0].related.delete();
Expected Results
No errors are thrown, the undefined or otherwise empty return value is returned from call.
Actual Results
...
...
(node:10779) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at /Users/kevinmitchell/.../cms-marketing-ui/node_modules/dc-management-sdk-js/build/main/lib/hal/services/HalClient.js:230:62
at processTicksAndRejections (internal/process/task_queues.js:97:5)
...
...
Affected browsers/environments
(full disclosure: I'm specifically testing on node v12.18.2 and didn't test on other versions. I suspect a similar result though)
[x ] NodeJS 8.x
[x ] NodeJS 10.x
[x ] NodeJS 12.x
Versions
"dc-management-sdk-js": "^1.10.0"
edit - I had wrongly assumed we were on the latest, looks like we were not and this was already fixed!
Description
When I attempt to use this library to delete webhooks, an exception is thrown because the HalClient attempts to parse ANY string response from the server as long as the response is a string. But,
JSON.parse
will complain if the string happens to be an empty string, as is the case with aDELETE
request.Steps to Reproduce
Expected Results
No errors are thrown, the
undefined
or otherwise empty return value is returned from call.Actual Results
Affected browsers/environments
(full disclosure: I'm specifically testing on node v12.18.2 and didn't test on other versions. I suspect a similar result though)
Versions
"dc-management-sdk-js": "^1.10.0"
edit - I had wrongly assumed we were on the latest, looks like we were not and this was already fixed!
"dc-management-sdk-js": "^1.8.0"