@shapediver/sdk.geometry-api-sdk-core
Advanced tools
Comparing version 1.0.12 to 1.0.13
import { SdkConfigInternal } from "../config/ShapeDiverSdkConfig"; | ||
export interface ShapeDiverSdkApiRequestOptions { | ||
contentType: string; | ||
contentType?: string; | ||
responseType: ShapeDiverSdkApiResponseType; | ||
@@ -37,8 +37,8 @@ disableAuthorization?: boolean; | ||
private static convertErrorResponseData; | ||
get<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<T>; | ||
post<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>; | ||
put<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>; | ||
patch<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>; | ||
delete<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<T>; | ||
get<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<[Record<string, any>, T]>; | ||
post<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<[Record<string, any>, T]>; | ||
put<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<[Record<string, any>, T]>; | ||
patch<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<[Record<string, any>, T]>; | ||
delete<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<[Record<string, any>, T]>; | ||
} | ||
//# sourceMappingURL=ShapeDiverSdkApi.d.ts.map |
@@ -46,3 +46,2 @@ "use strict"; | ||
request.headers = Object.assign({}, this.config.headers); | ||
request.headers["Content-Type"] = options.contentType; | ||
// Process HTTP authorization header | ||
@@ -57,8 +56,11 @@ if (options.disableAuthorization) { | ||
// Set data and convert depending on content-type | ||
if (options.contentType === "application/json" && data) { | ||
request.data = JSON.stringify(data); | ||
if (options.contentType) { | ||
request.headers["Content-Type"] = options.contentType; | ||
if (options.contentType === "application/json") { | ||
request.data = JSON.stringify(data !== null && data !== void 0 ? data : {}); | ||
} | ||
else { | ||
request.data = data; | ||
} | ||
} | ||
else { | ||
request.data = data; | ||
} | ||
return request; | ||
@@ -152,3 +154,3 @@ } | ||
const response = yield (0, axios_1.default)(this.buildUrl(url), config); | ||
return response.data; | ||
return [response.headers, response.data]; | ||
} | ||
@@ -168,3 +170,3 @@ catch (e) { | ||
const response = yield (0, axios_1.default)(this.buildUrl(url), config); | ||
return response.data; | ||
return [response.headers, response.data]; | ||
} | ||
@@ -184,3 +186,3 @@ catch (e) { | ||
const response = yield (0, axios_1.default)(this.buildUrl(url), config); | ||
return response.data; | ||
return [response.headers, response.data]; | ||
} | ||
@@ -200,3 +202,3 @@ catch (e) { | ||
const response = yield (0, axios_1.default)(this.buildUrl(url), config); | ||
return response.data; | ||
return [response.headers, response.data]; | ||
} | ||
@@ -216,3 +218,3 @@ catch (e) { | ||
const response = yield (0, axios_1.default)(this.buildUrl(url), config); | ||
return response.data; | ||
return [response.headers, response.data]; | ||
} | ||
@@ -219,0 +221,0 @@ catch (e) { |
{ | ||
"name": "@shapediver/sdk.geometry-api-sdk-core", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Core-library for SDK-packages to communicate with the Geometry API", | ||
@@ -41,3 +41,3 @@ "keywords": [], | ||
"devDependencies": { | ||
"jest": "^28.0.3", | ||
"jest": "^28.1.0", | ||
"lerna": "3.22.1", | ||
@@ -44,0 +44,0 @@ "typescript": "^4.6.4" |
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
39581
577