@shapediver/sdk.geometry-api-sdk-core
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -10,3 +10,4 @@ import { SdkConfigInternal } from "../config/ShapeDiverSdkConfig"; | ||
JSON = "json", | ||
DATA = "arraybuffer" | ||
DATA = "arraybuffer", | ||
TEXT = "text" | ||
} | ||
@@ -13,0 +14,0 @@ export declare class ShapeDiverSdkApi { |
@@ -30,2 +30,3 @@ "use strict"; | ||
ShapeDiverSdkApiResponseType["DATA"] = "arraybuffer"; | ||
ShapeDiverSdkApiResponseType["TEXT"] = "text"; | ||
})(ShapeDiverSdkApiResponseType = exports.ShapeDiverSdkApiResponseType || (exports.ShapeDiverSdkApiResponseType = {})); | ||
@@ -56,3 +57,3 @@ class ShapeDiverSdkApi { | ||
// Set data and convert depending on content-type | ||
if (options.contentType === "application/json") { | ||
if (options.contentType === "application/json" && data) { | ||
request.data = JSON.stringify(data); | ||
@@ -66,3 +67,6 @@ } | ||
buildUrl(uri) { | ||
if (uri.startsWith("http")) { | ||
if (typeof uri !== "string") { | ||
throw new ShapeDiverErrors_1.ShapeDiverError("No URL or URI was specified"); | ||
} | ||
else if (uri.startsWith("http")) { | ||
return uri; | ||
@@ -131,3 +135,10 @@ } | ||
} | ||
return JSON.parse(stringData); | ||
try { | ||
// This should work for the ShapeDiver backend | ||
return JSON.parse(stringData); | ||
} | ||
catch (_) { | ||
// This might be an XML when calling another system (e.g. S3) | ||
return { message: stringData }; | ||
} | ||
} | ||
@@ -139,3 +150,3 @@ get(url, options = { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const config = this.buildRequestConfig(Method.GET, options, {}); | ||
const config = this.buildRequestConfig(Method.GET, options, undefined); | ||
try { | ||
@@ -142,0 +153,0 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config); |
{ | ||
"name": "@shapediver/sdk.geometry-api-sdk-core", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Core-library for SDK-packages to communicate with the Geometry API", | ||
@@ -38,3 +38,3 @@ "keywords": [], | ||
"dependencies": { | ||
"axios": "^0.25.0" | ||
"axios": "^0.26.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38615
574
+ Addedaxios@0.26.1(transitive)
- Removedaxios@0.25.0(transitive)
Updatedaxios@^0.26.0