@azure/core-rest-pipeline
Advanced tools
Comparing version 1.0.3 to 1.0.4
# Release History | ||
## 1.0.4 (2021-05-27) | ||
- Bugfix for correctly sanitizing recursive objects for use in exceptions and logging. [PR 15426](https://github.com/Azure/azure-sdk-for-js/pull/15426) | ||
- Fixed an issue with calculating the content length of payloads containing multibyte characters and improved handling of 303 response codes. [PR 15314](https://github.com/Azure/azure-sdk-for-js/pull/15314) | ||
## 1.0.3 (2021-03-30) | ||
@@ -4,0 +9,0 @@ |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export const SDK_VERSION = "1.0.3"; | ||
export const SDK_VERSION = "1.0.4"; | ||
//# sourceMappingURL=constants.js.map |
@@ -267,3 +267,4 @@ // Copyright (c) Microsoft Corporation. | ||
} | ||
function getBodyLength(body) { | ||
/** @internal */ | ||
export function getBodyLength(body) { | ||
if (!body) { | ||
@@ -281,2 +282,5 @@ return 0; | ||
} | ||
else if (typeof body === "string") { | ||
return Buffer.from(body).length; | ||
} | ||
else { | ||
@@ -283,0 +287,0 @@ return null; |
@@ -47,2 +47,3 @@ // Copyright (c) Microsoft Corporation. | ||
request.method = "GET"; | ||
request.headers.delete("Content-Length"); | ||
delete request.body; | ||
@@ -49,0 +50,0 @@ } |
@@ -6,2 +6,3 @@ // Copyright (c) Microsoft Corporation. | ||
* A constant that indicates whether the environment the code is running is Node.JS. | ||
* @internal | ||
*/ | ||
@@ -11,2 +12,3 @@ export const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node); | ||
* A wrapper for setTimeout that resolves a promise after t milliseconds. | ||
* @internal | ||
* @param t - The number of milliseconds to be delayed. | ||
@@ -38,2 +40,13 @@ * @param value - The value to be resolved with after a timeout of t milliseconds. | ||
} | ||
/** | ||
* @internal | ||
* @returns true when input is an object type that is not null, Array, RegExp, or Date. | ||
*/ | ||
export function isObject(input) { | ||
return (typeof input === "object" && | ||
input !== null && | ||
!Array.isArray(input) && | ||
!(input instanceof RegExp) && | ||
!(input instanceof Date)); | ||
} | ||
//# sourceMappingURL=helpers.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { isObject } from "./helpers"; | ||
import { URL } from "./url"; | ||
@@ -56,33 +57,39 @@ const RedactedString = "REDACTED"; | ||
sanitize(obj) { | ||
return JSON.stringify(obj, this.replacer.bind(this), 2); | ||
const seen = new Set(); | ||
return JSON.stringify(obj, (key, value) => { | ||
// Ensure Errors include their interesting non-enumerable members | ||
if (value instanceof Error) { | ||
return Object.assign(Object.assign({}, value), { name: value.name, message: value.message }); | ||
} | ||
if (key === "headers") { | ||
return this.sanitizeHeaders(value); | ||
} | ||
else if (key === "url") { | ||
return this.sanitizeUrl(value); | ||
} | ||
else if (key === "query") { | ||
return this.sanitizeQuery(value); | ||
} | ||
else if (key === "body") { | ||
// Don't log the request body | ||
return undefined; | ||
} | ||
else if (key === "response") { | ||
// Don't log response again | ||
return undefined; | ||
} | ||
else if (key === "operationSpec") { | ||
// When using sendOperationRequest, the request carries a massive | ||
// field with the autorest spec. No need to log it. | ||
return undefined; | ||
} | ||
else if (Array.isArray(value) || isObject(value)) { | ||
if (seen.has(value)) { | ||
return "[Circular]"; | ||
} | ||
seen.add(value); | ||
} | ||
return value; | ||
}, 2); | ||
} | ||
replacer(key, value) { | ||
// Ensure Errors include their interesting non-enumerable members | ||
if (value instanceof Error) { | ||
return Object.assign(Object.assign({}, value), { name: value.name, message: value.message }); | ||
} | ||
if (key === "headers") { | ||
return this.sanitizeHeaders(value); | ||
} | ||
else if (key === "url") { | ||
return this.sanitizeUrl(value); | ||
} | ||
else if (key === "query") { | ||
return this.sanitizeQuery(value); | ||
} | ||
else if (key === "body") { | ||
// Don't log the request body | ||
return undefined; | ||
} | ||
else if (key === "response") { | ||
// Don't log response again | ||
return undefined; | ||
} | ||
else if (key === "operationSpec") { | ||
// When using sendOperationRequest, the request carries a massive | ||
// field with the autorest spec. No need to log it. | ||
return undefined; | ||
} | ||
return value; | ||
} | ||
sanitizeHeaders(obj) { | ||
@@ -89,0 +96,0 @@ const sanitized = {}; |
{ | ||
"name": "@azure/core-rest-pipeline", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Isomorphic client library for making HTTP requests in node.js and browser.", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
501898
5438