@azure/core-client 1.4.0 → 1.4.1-alpha.20220120.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ## 1.4.1 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ - Addressed an issue where the `onResponse` callback wouldn't be called in certain cases where an unexpected response was received from the service. [PR #19702](https://github.com/Azure/azure-sdk-for-js/pull/19702)
12
+
13
+ ### Other Changes
14
+
3
15
  ## 1.4.0 (2022-01-06)
4
16
 
5
17
  ### Features Added
package/README.md CHANGED
@@ -37,11 +37,11 @@ The method `createSerializer` creates a `Serializer` that is used to do the bulk
37
37
 
38
38
  ## Examples
39
39
 
40
- Examples can be found in the `samples` folder.
40
+ Examples can be found in the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-client/samples) folder.
41
41
 
42
42
  ## Next steps
43
43
 
44
- You can build and run the tests locally by executing `rushx test`. Explore the `test` folder to see advanced usage and behavior of the public classes.
44
+ You can build and run the tests locally by executing `rushx test`. Explore the [test](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-client/test) folder to see advanced usage and behavior of the public classes.
45
45
 
46
46
  Learn more about [AutoRest](https://github.com/Azure/autorest) and the [autorest.typescript extension](https://github.com/Azure/autorest.typescript) for generating a compatible client on top of this package.
47
47
 
package/dist/index.js CHANGED
@@ -1172,7 +1172,13 @@ function getRequestUrl(baseUri, operationSpec, operationArguments, fallbackObjec
1172
1172
  let isAbsolutePath = false;
1173
1173
  let requestUrl = replaceAll(baseUri, urlReplacements);
1174
1174
  if (operationSpec.path) {
1175
- const path = replaceAll(operationSpec.path, urlReplacements);
1175
+ let path = replaceAll(operationSpec.path, urlReplacements);
1176
+ // QUIRK: sometimes we get a path component like /{nextLink}
1177
+ // which may be a fully formed URL with a leading /. In that case, we should
1178
+ // remove the leading /
1179
+ if (operationSpec.path === "/{nextLink}" && path.startsWith("/")) {
1180
+ path = path.substring(1);
1181
+ }
1176
1182
  // QUIRK: sometimes we get a path component like {nextLink}
1177
1183
  // which may be a fully formed URL. In that case, we should
1178
1184
  // ignore the baseUri.
@@ -1881,8 +1887,13 @@ class ServiceClient {
1881
1887
  return flatResponse;
1882
1888
  }
1883
1889
  catch (error) {
1884
- if (error.response) {
1885
- error.details = flattenResponse(error.response, operationSpec.responses[error.statusCode] || operationSpec.responses["default"]);
1890
+ if (typeof error === "object" && (error === null || error === void 0 ? void 0 : error.response)) {
1891
+ const rawResponse = error.response;
1892
+ const flatResponse = flattenResponse(rawResponse, operationSpec.responses[error.statusCode] || operationSpec.responses["default"]);
1893
+ error.details = flatResponse;
1894
+ if (options === null || options === void 0 ? void 0 : options.onResponse) {
1895
+ options.onResponse(rawResponse, flatResponse, error);
1896
+ }
1886
1897
  }
1887
1898
  throw error;
1888
1899
  }