Skip to content

Commit 7d704c7

Browse files
author
Connor O'Brien
committed
Fix for null return data in object body response
1 parent f5f0fd9 commit 7d704c7

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

dist/ordercloud-javascript-sdk.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3893,6 +3893,8 @@ exports.prototype.callAuth = function callApi(path, httpMethod, pathParams,
38933893
* @returns An instance of the specified type.
38943894
*/
38953895
exports.convertToType = function(data, type) {
3896+
if (data === null)
3897+
return null;
38963898
switch (type) {
38973899
case 'Boolean':
38983900
return Boolean(data);
@@ -3901,15 +3903,9 @@ exports.prototype.callAuth = function callApi(path, httpMethod, pathParams,
39013903
case 'Number':
39023904
return parseFloat(data);
39033905
case 'String':
3904-
if (data !== null) {
3905-
return String(data);
3906-
}
3907-
else return null;
3906+
return String(data);
39083907
case 'Date':
3909-
if (data !== null) {
3910-
return this.parseDate(String(data));
3911-
}
3912-
else return null;
3908+
return this.parseDate(String(data));
39133909
default:
39143910
if (type === Object) {
39153911
// generic object, return directly

0 commit comments

Comments
 (0)