nextemos 5.5.10 → 5.5.11
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.
|
@@ -38,7 +38,7 @@ const fetchRequest = () => {
|
|
|
38
38
|
* @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
|
|
39
39
|
*/
|
|
40
40
|
const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
var _b;
|
|
41
|
+
var _b, _c;
|
|
42
42
|
var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
|
|
43
43
|
const apiURL = new URL(url);
|
|
44
44
|
if (params) {
|
|
@@ -58,6 +58,11 @@ const fetchRequest = () => {
|
|
|
58
58
|
method === __1.HTTPMethod.PUT ||
|
|
59
59
|
method === __1.HTTPMethod.DELETE) {
|
|
60
60
|
options.headers = Object.assign({ ["Content-Type"]: "application/json" }, options.headers);
|
|
61
|
+
// if output-cache-key is in headers, append it to the body
|
|
62
|
+
const bodyWithOutputCacheKey = Object.assign(Object.assign({}, (typeof options.body === "string"
|
|
63
|
+
? JSON.parse(options.body || "{}")
|
|
64
|
+
: {})), { outputCacheKey: (_b = options.headers) === null || _b === void 0 ? void 0 : _b["output-cache-key"] });
|
|
65
|
+
options.body = JSON.stringify(bodyWithOutputCacheKey);
|
|
61
66
|
}
|
|
62
67
|
// İstek seçeneklerini oluştur
|
|
63
68
|
const requestOptions = Object.assign(Object.assign({}, options), { method });
|
|
@@ -86,7 +91,7 @@ const fetchRequest = () => {
|
|
|
86
91
|
console.log("Fetch Error: ", {
|
|
87
92
|
apiUrl: apiURL.toString(),
|
|
88
93
|
status: response.status,
|
|
89
|
-
errorMessage: ((
|
|
94
|
+
errorMessage: ((_c = JSON.parse(errorDetail || "{}")) === null || _c === void 0 ? void 0 : _c.message) || errorDetail,
|
|
90
95
|
});
|
|
91
96
|
return {
|
|
92
97
|
status: response.status,
|