@azure/core-client 1.6.2-alpha.20221201.1 → 1.7.0
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.
package/dist/index.js
CHANGED
|
@@ -1148,7 +1148,14 @@ function getPropertyFromParameterPath(parent, parameterPath) {
|
|
|
1148
1148
|
return result;
|
|
1149
1149
|
}
|
|
1150
1150
|
const operationRequestMap = new WeakMap();
|
|
1151
|
+
const originalRequestSymbol = Symbol.for("@azure/core-client original request");
|
|
1152
|
+
function hasOriginalRequest(request) {
|
|
1153
|
+
return originalRequestSymbol in request;
|
|
1154
|
+
}
|
|
1151
1155
|
function getOperationRequestInfo(request) {
|
|
1156
|
+
if (hasOriginalRequest(request)) {
|
|
1157
|
+
return getOperationRequestInfo(request[originalRequestSymbol]);
|
|
1158
|
+
}
|
|
1152
1159
|
let info = operationRequestMap.get(request);
|
|
1153
1160
|
if (!info) {
|
|
1154
1161
|
info = {};
|
|
@@ -1230,7 +1237,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
|
|
|
1230
1237
|
return parsedResponse;
|
|
1231
1238
|
}
|
|
1232
1239
|
const responseSpec = getOperationResponseMap(parsedResponse);
|
|
1233
|
-
const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec);
|
|
1240
|
+
const { error, shouldReturnResponse } = handleErrorResponse(parsedResponse, operationSpec, responseSpec, options);
|
|
1234
1241
|
if (error) {
|
|
1235
1242
|
throw error;
|
|
1236
1243
|
}
|
|
@@ -1249,7 +1256,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
|
|
|
1249
1256
|
: [];
|
|
1250
1257
|
}
|
|
1251
1258
|
try {
|
|
1252
|
-
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody");
|
|
1259
|
+
parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
|
|
1253
1260
|
}
|
|
1254
1261
|
catch (deserializeError) {
|
|
1255
1262
|
const restError = new coreRestPipeline.RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
|
|
@@ -1275,7 +1282,7 @@ function isOperationSpecEmpty(operationSpec) {
|
|
|
1275
1282
|
return (expectedStatusCodes.length === 0 ||
|
|
1276
1283
|
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
|
|
1277
1284
|
}
|
|
1278
|
-
function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
|
|
1285
|
+
function handleErrorResponse(parsedResponse, operationSpec, responseSpec, options) {
|
|
1279
1286
|
var _a;
|
|
1280
1287
|
const isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
|
|
1281
1288
|
const isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
|
|
@@ -1322,7 +1329,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
|
|
|
1322
1329
|
valueToDeserialize = parsedBody[elementName];
|
|
1323
1330
|
}
|
|
1324
1331
|
}
|
|
1325
|
-
deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody");
|
|
1332
|
+
deserializedError = operationSpec.serializer.deserialize(defaultBodyMapper, valueToDeserialize, "error.response.parsedBody", options);
|
|
1326
1333
|
}
|
|
1327
1334
|
const internalError = parsedBody.error || deserializedError || parsedBody;
|
|
1328
1335
|
error.code = internalError.code;
|