chargebee 3.0.0-beta.1 → 3.0.0-beta.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,3 +1,9 @@
1
+ ### v3.0.0-beta.2 (2024-08-29)
2
+ * * *
3
+
4
+ #### Bug Fixes:
5
+ * content-length bug fixes for fetch.
6
+
1
7
  ### v3.0.0-beta.1 (2024-08-26)
2
8
  * * *
3
9
 
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This is the [Node.js](http://nodejs.org/) library for integrating with Chargebee. Sign up for a Chargebee account [here](https://www.chargebee.com).
4
4
 
5
+ Please refer to the [migration guide](https://github.com/chargebee/chargebee-node/wiki/Migration-guide-for-v3) if you are migrating from the older versions of [chargebee-typescript](https://www.npmjs.com/package/chargebee-typescript) or [chargebee](https://www.npmjs.com/package/chargebee/v/2.40.0).
6
+
5
7
  ## Requirements
6
8
 
7
9
  Node.js 18 or higher.
@@ -144,4 +146,4 @@ If you find any bugs or have any feedback, open an issue in this repository or e
144
146
 
145
147
  ## License
146
148
 
147
- See the [LICENSE](./LICENSE) file.
149
+ See the [LICENSE](./LICENSE) file.
@@ -4,7 +4,6 @@ exports.RequestWrapper = void 0;
4
4
  const util_js_1 = require("./util.js");
5
5
  const coreCommon_js_1 = require("./coreCommon.js");
6
6
  const node_buffer_1 = require("node:buffer");
7
- const IDEMPOTENCY_HEADER = 'chargebee-idempotency-key';
8
7
  class RequestWrapper {
9
8
  constructor(args, apiCall, envArg) {
10
9
  this.getRequest = () => {
@@ -55,11 +54,15 @@ class RequestWrapper {
55
54
  params = {};
56
55
  }
57
56
  let data = (0, util_js_1.encodeParams)(params);
57
+ if (data.length) {
58
+ (0, util_js_1.extend)(true, this.httpHeaders, {
59
+ 'Content-Length': data.length,
60
+ });
61
+ }
58
62
  (0, util_js_1.extend)(true, this.httpHeaders, {
59
63
  Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'),
60
64
  Accept: 'application/json',
61
65
  'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
62
- 'Content-Length': data.length,
63
66
  'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion,
64
67
  'Lang-Version': typeof process === 'undefined' ? '' : process.version,
65
68
  });
@@ -11,7 +11,7 @@ exports.Environment = {
11
11
  hostSuffix: '.chargebee.com',
12
12
  apiPath: '/api/v2',
13
13
  timeout: DEFAULT_TIME_OUT,
14
- clientVersion: 'v3.0.0-beta.1',
14
+ clientVersion: 'v3.0.0-beta.2',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -1,7 +1,6 @@
1
1
  import { extend, callbackifyPromise, getApiURL, encodeListParams, encodeParams, serialize, getHost, } from './util.js';
2
2
  import { handleResponse } from './coreCommon.js';
3
3
  import { Buffer } from 'node:buffer';
4
- const IDEMPOTENCY_HEADER = 'chargebee-idempotency-key';
5
4
  export class RequestWrapper {
6
5
  constructor(args, apiCall, envArg) {
7
6
  this.getRequest = () => {
@@ -52,11 +51,15 @@ export class RequestWrapper {
52
51
  params = {};
53
52
  }
54
53
  let data = encodeParams(params);
54
+ if (data.length) {
55
+ extend(true, this.httpHeaders, {
56
+ 'Content-Length': data.length,
57
+ });
58
+ }
55
59
  extend(true, this.httpHeaders, {
56
60
  Authorization: 'Basic ' + Buffer.from(env.apiKey + ':').toString('base64'),
57
61
  Accept: 'application/json',
58
62
  'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
59
- 'Content-Length': data.length,
60
63
  'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion,
61
64
  'Lang-Version': typeof process === 'undefined' ? '' : process.version,
62
65
  });
@@ -8,7 +8,7 @@ export const Environment = {
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
10
  timeout: DEFAULT_TIME_OUT,
11
- clientVersion: 'v3.0.0-beta.1',
11
+ clientVersion: 'v3.0.0-beta.2',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",