stripe 20.1.1 → 20.1.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,4 +1,8 @@
1
1
  # Changelog
2
+ ## 20.1.2 - 2026-01-07
3
+ * [#2542](https://github.com/stripe/stripe-node/pull/2542) Fix content length calculations for multipart file uploads. This fixes the bug reported in [2538](https://github.com/stripe/stripe-node/issues/2538) around file uploads.
4
+ * [#2539](https://github.com/stripe/stripe-node/pull/2539) Delete API_VERSION file as it is no longer needed
5
+
2
6
  ## 20.1.1 - 2026-01-06
3
7
  * [#2535](https://github.com/stripe/stripe-node/pull/2535) Update qs dependency to latest version
4
8
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 20.1.1
1
+ 20.1.2
@@ -342,6 +342,14 @@ class RequestSender {
342
342
  });
343
343
  return requestPromise;
344
344
  }
345
+ _getContentLength(data) {
346
+ // if we calculate this wrong, the server treats it as invalid json
347
+ // or if content length is too big, the request never finishes and it
348
+ // times out.
349
+ return typeof data === 'string'
350
+ ? new TextEncoder().encode(data).length
351
+ : data.length;
352
+ }
345
353
  _request(method, host, path, data, authenticator, options, usage = [], callback, requestDataProcessor = null) {
346
354
  var _a;
347
355
  let requestData;
@@ -430,7 +438,7 @@ class RequestSender {
430
438
  contentType: apiMode == 'v2'
431
439
  ? 'application/json'
432
440
  : 'application/x-www-form-urlencoded',
433
- contentLength: new TextEncoder().encode(requestData).length,
441
+ contentLength: this._getContentLength(data),
434
442
  apiVersion: apiVersion,
435
443
  clientUserAgent,
436
444
  method,
@@ -37,7 +37,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
37
37
  ];
38
38
  const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
39
39
  function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
40
- Stripe.PACKAGE_VERSION = '20.1.1';
40
+ Stripe.PACKAGE_VERSION = '20.1.2';
41
41
  Stripe.API_VERSION = apiVersion_js_1.ApiVersion;
42
42
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)());
43
43
  Stripe.StripeResource = StripeResource_js_1.StripeResource;
@@ -339,6 +339,14 @@ export class RequestSender {
339
339
  });
340
340
  return requestPromise;
341
341
  }
342
+ _getContentLength(data) {
343
+ // if we calculate this wrong, the server treats it as invalid json
344
+ // or if content length is too big, the request never finishes and it
345
+ // times out.
346
+ return typeof data === 'string'
347
+ ? new TextEncoder().encode(data).length
348
+ : data.length;
349
+ }
342
350
  _request(method, host, path, data, authenticator, options, usage = [], callback, requestDataProcessor = null) {
343
351
  var _a;
344
352
  let requestData;
@@ -427,7 +435,7 @@ export class RequestSender {
427
435
  contentType: apiMode == 'v2'
428
436
  ? 'application/json'
429
437
  : 'application/x-www-form-urlencoded',
430
- contentLength: new TextEncoder().encode(requestData).length,
438
+ contentLength: this._getContentLength(data),
431
439
  apiVersion: apiVersion,
432
440
  clientUserAgent,
433
441
  method,
@@ -34,7 +34,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
34
34
  ];
35
35
  const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
36
36
  export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
37
- Stripe.PACKAGE_VERSION = '20.1.1';
37
+ Stripe.PACKAGE_VERSION = '20.1.2';
38
38
  Stripe.API_VERSION = ApiVersion;
39
39
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
40
40
  Stripe.StripeResource = StripeResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "20.1.1",
3
+ "version": "20.1.2",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",