@azure/storage-queue 12.23.0-beta.1 → 12.23.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
@@ -329,7 +329,7 @@ function ipRangeToString(ipRange) {
329
329
 
330
330
  // Copyright (c) Microsoft Corporation.
331
331
  // Licensed under the MIT license.
332
- const SDK_VERSION = "12.23.0-beta.1";
332
+ const SDK_VERSION = "12.23.0";
333
333
  const SERVICE_VERSION = "2024-08-04";
334
334
  /**
335
335
  * The OAuth scope to use with Azure Storage.
@@ -1979,6 +1979,32 @@ class StorageBrowserPolicyFactory {
1979
1979
  }
1980
1980
  }
1981
1981
 
1982
+ // Copyright (c) Microsoft Corporation.
1983
+ // Licensed under the MIT license.
1984
+ /**
1985
+ * The programmatic identifier of the storageCorrectContentLengthPolicy.
1986
+ */
1987
+ const storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy";
1988
+ /**
1989
+ * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.
1990
+ */
1991
+ function storageCorrectContentLengthPolicy() {
1992
+ function correctContentLength(request) {
1993
+ if (request.body &&
1994
+ (typeof request.body === "string" || Buffer.isBuffer(request.body)) &&
1995
+ request.body.length > 0) {
1996
+ request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
1997
+ }
1998
+ }
1999
+ return {
2000
+ name: storageCorrectContentLengthPolicyName,
2001
+ async sendRequest(request, next) {
2002
+ correctContentLength(request);
2003
+ return next(request);
2004
+ },
2005
+ };
2006
+ }
2007
+
1982
2008
  // Copyright (c) Microsoft Corporation.
1983
2009
  // Licensed under the MIT license.
1984
2010
  /**
@@ -2108,6 +2134,7 @@ function getCoreClientOptions(pipeline) {
2108
2134
  } }));
2109
2135
  corePipeline.removePolicy({ phase: "Retry" });
2110
2136
  corePipeline.removePolicy({ name: coreRestPipeline.decompressResponsePolicyName });
2137
+ corePipeline.addPolicy(storageCorrectContentLengthPolicy());
2111
2138
  corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
2112
2139
  corePipeline.addPolicy(storageBrowserPolicy());
2113
2140
  const downlevelResults = processDownlevelPipeline(pipeline);
@@ -5032,7 +5059,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
5032
5059
  const defaults = {
5033
5060
  requestContentType: "application/json; charset=utf-8"
5034
5061
  };
5035
- const packageDetails = `azsdk-js-azure-storage-queue/12.23.0-beta.1`;
5062
+ const packageDetails = `azsdk-js-azure-storage-queue/12.23.0`;
5036
5063
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
5037
5064
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
5038
5065
  : `${packageDetails}`;