@azure/storage-file-share 12.24.0-beta.1 → 12.24.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -336,7 +336,7 @@ function ipRangeToString(ipRange) {
336
336
 
337
337
  // Copyright (c) Microsoft Corporation.
338
338
  // Licensed under the MIT license.
339
- const SDK_VERSION = "12.24.0-beta.1";
339
+ const SDK_VERSION = "12.24.0";
340
340
  const SERVICE_VERSION = "2024-08-04";
341
341
  const FILE_MAX_SIZE_BYTES = 4 * 1024 * 1024 * 1024 * 1024; // 4TB
342
342
  const FILE_RANGE_MAX_SIZE_BYTES = 4 * 1024 * 1024; // 4MB
@@ -2503,6 +2503,32 @@ class StorageBrowserPolicyFactory {
2503
2503
  }
2504
2504
  }
2505
2505
 
2506
+ // Copyright (c) Microsoft Corporation.
2507
+ // Licensed under the MIT license.
2508
+ /**
2509
+ * The programmatic identifier of the storageCorrectContentLengthPolicy.
2510
+ */
2511
+ const storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy";
2512
+ /**
2513
+ * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.
2514
+ */
2515
+ function storageCorrectContentLengthPolicy() {
2516
+ function correctContentLength(request) {
2517
+ if (request.body &&
2518
+ (typeof request.body === "string" || Buffer.isBuffer(request.body)) &&
2519
+ request.body.length > 0) {
2520
+ request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
2521
+ }
2522
+ }
2523
+ return {
2524
+ name: storageCorrectContentLengthPolicyName,
2525
+ async sendRequest(request, next) {
2526
+ correctContentLength(request);
2527
+ return next(request);
2528
+ },
2529
+ };
2530
+ }
2531
+
2506
2532
  // Copyright (c) Microsoft Corporation.
2507
2533
  // Licensed under the MIT license.
2508
2534
  /**
@@ -2632,6 +2658,7 @@ function getCoreClientOptions(pipeline) {
2632
2658
  } }));
2633
2659
  corePipeline.removePolicy({ phase: "Retry" });
2634
2660
  corePipeline.removePolicy({ name: coreRestPipeline.decompressResponsePolicyName });
2661
+ corePipeline.addPolicy(storageCorrectContentLengthPolicy());
2635
2662
  corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
2636
2663
  corePipeline.addPolicy(storageBrowserPolicy());
2637
2664
  const downlevelResults = processDownlevelPipeline(pipeline);
@@ -11178,7 +11205,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
11178
11205
  const defaults = {
11179
11206
  requestContentType: "application/json; charset=utf-8"
11180
11207
  };
11181
- const packageDetails = `azsdk-js-azure-storage-file-share/12.24.0-beta.1`;
11208
+ const packageDetails = `azsdk-js-azure-storage-file-share/12.24.0`;
11182
11209
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
11183
11210
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
11184
11211
  : `${packageDetails}`;