zenrows 2.0.0 → 2.0.1

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.cjs CHANGED
@@ -39,7 +39,7 @@ var import_fetch_retry = __toESM(require("fetch-retry"), 1);
39
39
  // package.json
40
40
  var package_default = {
41
41
  name: "zenrows",
42
- version: "1.3.2",
42
+ version: "2.0.1",
43
43
  description: "ZenRows Node SDK",
44
44
  main: "./dist/index.cjs",
45
45
  module: "./dist/index.js",
@@ -120,13 +120,27 @@ var ZenRows = class {
120
120
  post(url, config, { headers = {}, data = {} } = {
121
121
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
122
122
  }) {
123
+ const normalizedHeaders = Object.keys(headers).reduce(
124
+ (acc, key) => {
125
+ const value = headers[key];
126
+ if (value !== void 0) {
127
+ if (key.toLowerCase() === "content-type") {
128
+ acc["Content-Type"] = value;
129
+ } else {
130
+ acc[key] = value;
131
+ }
132
+ }
133
+ return acc;
134
+ },
135
+ {}
136
+ );
123
137
  return this.queue.push({
124
138
  url,
125
139
  method: "POST",
126
140
  config,
127
141
  headers: {
128
142
  "Content-Type": "application/x-www-form-urlencoded",
129
- ...headers
143
+ ...normalizedHeaders
130
144
  },
131
145
  data
132
146
  });
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import fetchRetry from "fetch-retry";
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "zenrows",
8
- version: "1.3.2",
8
+ version: "2.0.1",
9
9
  description: "ZenRows Node SDK",
10
10
  main: "./dist/index.cjs",
11
11
  module: "./dist/index.js",
@@ -86,13 +86,27 @@ var ZenRows = class {
86
86
  post(url, config, { headers = {}, data = {} } = {
87
87
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
88
88
  }) {
89
+ const normalizedHeaders = Object.keys(headers).reduce(
90
+ (acc, key) => {
91
+ const value = headers[key];
92
+ if (value !== void 0) {
93
+ if (key.toLowerCase() === "content-type") {
94
+ acc["Content-Type"] = value;
95
+ } else {
96
+ acc[key] = value;
97
+ }
98
+ }
99
+ return acc;
100
+ },
101
+ {}
102
+ );
89
103
  return this.queue.push({
90
104
  url,
91
105
  method: "POST",
92
106
  config,
93
107
  headers: {
94
108
  "Content-Type": "application/x-www-form-urlencoded",
95
- ...headers
109
+ ...normalizedHeaders
96
110
  },
97
111
  data
98
112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenrows",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "ZenRows Node SDK",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",