@apigames/sdk-core 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -108,18 +108,16 @@ class ResourceObject {
|
|
|
108
108
|
const queryOptions = {};
|
|
109
109
|
const payload = this.GetInsertPayload();
|
|
110
110
|
const response = yield this._container.restClient.Post(queryUri, payload, queryHeaders, queryOptions);
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
&& (0, json_1.isString)(response.data.data.id) && (0, json_1.hasProperty)(response.data.data, 'links')
|
|
114
|
-
&& (0, json_1.isObject)(response.data.data.links) && (0, json_1.hasProperty)(response.data.data.links, 'self')
|
|
115
|
-
&& (0, json_1.isString)(response.data.data.links.self)) {
|
|
116
|
-
this.id = response.data.data.id;
|
|
117
|
-
this._uri = response.data.data.links.self;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
throw new __1.SDKException('SAVE-FAILED', 'The save operation was unable to retrieve the identifier '
|
|
111
|
+
if (!this.HasHeader(response.headers, 'location')) {
|
|
112
|
+
throw new __1.SDKException('INVALID-LOCATION', 'The save operation was unable to retrieve the location '
|
|
121
113
|
+ 'of the resource created by the API.');
|
|
122
114
|
}
|
|
115
|
+
if (!this.HasHeader(response.headers, 'x-api-resource-id')) {
|
|
116
|
+
throw new __1.SDKException('INVALID-RESOURCE-ID', 'The save operation was unable to retrieve the '
|
|
117
|
+
+ 'identifier of the resource created by the API.');
|
|
118
|
+
}
|
|
119
|
+
this.id = this.GetHeaderValue(response.headers, 'x-api-resource-id');
|
|
120
|
+
this._uri = this.GetHeaderValue(response.headers, 'location');
|
|
123
121
|
this._mode = ResourceObjectMode.ExistingDocument;
|
|
124
122
|
});
|
|
125
123
|
}
|