curlnapi-node 0.1.10 → 0.1.12

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/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export type HttpMethod =
10
10
  export interface ImpitOptions {
11
11
  timeout?: number;
12
12
  followRedirects?: boolean;
13
+ debug?: boolean;
13
14
  browser?: string;
14
15
  proxyUrl?: string;
15
16
  userAgent?: string;
package/index.wrapper.js CHANGED
@@ -30,17 +30,23 @@ async function parseFetchOptions(resource, init) {
30
30
  } else {
31
31
  url = resource
32
32
  }
33
- options.headers = canonicalizeHeaders(options?.headers)
33
+ const headerEntries = canonicalizeHeaders(options?.headers)
34
34
  if (options?.body) {
35
35
  const { body, type } = await castToTypedArray(options.body)
36
36
  options.body = body
37
- if (type && !options.headers.some(([k]) => String(k).toLowerCase() === 'content-type')) {
38
- options.headers.push(['Content-Type', type])
37
+ if (type && !headerEntries.some(([k]) => String(k).toLowerCase() === 'content-type')) {
38
+ headerEntries.push(['Content-Type', type])
39
39
  }
40
40
  } else {
41
41
  delete options.body
42
42
  }
43
- const out = { url, method: options.method, headers: options.headers, body: options.body, signal: options.signal }
43
+ const out = {
44
+ url,
45
+ method: options.method,
46
+ headers: Object.fromEntries(headerEntries),
47
+ body: options.body,
48
+ signal: options.signal,
49
+ }
44
50
  if (typeof options.timeout === 'number') out.timeout = options.timeout
45
51
  return out
46
52
  }
@@ -109,4 +115,3 @@ module.exports.HttpMethod = {
109
115
  TRACE: 'TRACE',
110
116
  CONNECT: 'CONNECT',
111
117
  }
112
-
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "curlnapi-node",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "description": "Node binding for curl-impersonate with a requests-like API",
6
6
  "main": "index.wrapper.js",
7
+ "types": "index.d.ts",
7
8
  "scripts": {
8
9
  "test": "node examples/test.js"
9
10
  },
@@ -0,0 +1,27 @@
1
+ {
2
+ "requestsFinished": 1,
3
+ "requestsFailed": 0,
4
+ "requestsRetries": 0,
5
+ "requestsFailedPerMinute": 0,
6
+ "requestsFinishedPerMinute": 16,
7
+ "requestMinDurationMillis": 3199,
8
+ "requestMaxDurationMillis": 3199,
9
+ "requestTotalFailedDurationMillis": 0,
10
+ "requestTotalFinishedDurationMillis": 3199,
11
+ "crawlerStartedAt": "2026-01-18T14:16:23.037Z",
12
+ "crawlerFinishedAt": "2026-01-18T14:16:26.864Z",
13
+ "statsPersistedAt": "2026-01-18T14:16:26.864Z",
14
+ "crawlerRuntimeMillis": 3849,
15
+ "crawlerLastStartTimestamp": 1768745783015,
16
+ "requestRetryHistogram": [
17
+ 1
18
+ ],
19
+ "statsId": 0,
20
+ "requestAvgFailedDurationMillis": null,
21
+ "requestAvgFinishedDurationMillis": 3199,
22
+ "requestTotalDurationMillis": 3199,
23
+ "requestsTotal": 1,
24
+ "requestsWithStatusCode": {},
25
+ "errors": {},
26
+ "retryErrors": {}
27
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "usableSessionsCount": 1,
3
+ "retiredSessionsCount": 0,
4
+ "sessions": [
5
+ {
6
+ "id": "session_NXfhMA7AK1",
7
+ "cookieJar": {
8
+ "version": "tough-cookie@6.0.0",
9
+ "storeType": "MemoryCookieStore",
10
+ "rejectPublicSuffixes": true,
11
+ "enableLooseMode": false,
12
+ "allowSpecialUseDomain": true,
13
+ "prefixSecurity": "silent",
14
+ "cookies": []
15
+ },
16
+ "userData": {},
17
+ "maxErrorScore": 3,
18
+ "errorScoreDecrement": 0.5,
19
+ "expiresAt": "2026-01-18T15:06:23.492Z",
20
+ "createdAt": "2026-01-18T14:16:23.492Z",
21
+ "usageCount": 1,
22
+ "maxUsageCount": 50,
23
+ "errorScore": 0
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": "yxf2frnzAiMpu2N",
3
+ "json": "{\"id\":\"yxf2frnzAiMpu2N\",\"url\":\"https://httpbin.org/get\",\"loadedUrl\":\"https://httpbin.org/get\",\"uniqueKey\":\"https://httpbin.org/get\",\"method\":\"GET\",\"noRetry\":false,\"retryCount\":0,\"errorMessages\":[],\"headers\":{\"Cache-Control\":\"max-age=0\",\"Upgrade-Insecure-Requests\":\"1\",\"User-Agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\",\"Accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7\",\"Accept-Language\":\"en-GB,en;q=0.9\",\"Cookie\":\"session-id=520-3432763-6619032; lc-acbuk=en_GB; ubid-acbuk=261-8790247-0855808; sso-state-acbuk=Xdsso|ZQG-J6z6kqG231syhNdNwhS5_Q7lcebxYKWUYRvz0Svu0x-axk_3b2Rb5NEeGPEAXIjkHc8KUNsUJgDg6MbaRuVXDRZg5ajuU505UwHWg8KZ3Ovr; i18n-prefs=GBP; at-acbuk=Atza|gQC4SOQtAwEBALe-NKeevTEzTSfrCiEdLfTAZiaglHSVfBbK2B_RpLt4rMAMIprXUtKQFv0gCICBSKWRuGpN9a_nAIW_SdgiFXfiREYIUEV19FIHjYgSMpGmgmtdwYqN48lecXt1-71N5FWHUt1o34rRZHkTPyYwfjuaxjHL3r_xGZjP2H5pYX3i5l5w3KP87RAbLPtd_0v1Ao-RkGqHOYEdpXzvBGdreYuwKmHLvznQ1EB6fRvAR6ZJsCBchwqD7o03Qe-ViNuM273Nmxcw2mowfKF5PCwHP1spQjxh9ZGRvnwgPHsQqZwQ7euEw9eOMhWQxg45HvGEFBdT0hrdrqgGQCSNdDFHOKgQT30j3wlobamZ_SFPSEmw1zpfGlZYdhGsk7ymgRSNtspvVkvBrHR9DUDnQZsVFjoVSzPAWoXMDKE; sess-at-acbuk=h8dyKZqGM54ZLiasgvsg9UM7HSVPWcSGBD9l4z7zc2s=; sst-acbuk=Sst1|PQLzwohMykcZpPcYyruIYpxBCivK2t-Y2deQrVmDQpvwd5JAi7BnYGEUZMfxeJm-htVNEJe3GuTmiMFT87mNiHAdTXRRV-dXWq4T2d92y6mzRve0XjDO1oLRZfGweDe9S8lKQB7Lvowwcc2HpXBDnfyvCZKdxcHaMVGrynZUfqaYtZcnUhpRBAHp6sQtEEhOq_KL_ErRQCoAU-Rz2_KhxHnyPxhFDcJw_iPI23ZLvvAdtMcyDAhCVYs5yXdGu_sndL-iYQu5aqdta7lNTzDefH4Wiar69YD0BQe-aC4ybrVOtylJF4hFWNE6xAFH3pYVuJMq; session-id-time=2082787201l; x-acbuk=\\\"D6E1EmC2Gt61jieU59NPG@O5RMFD9xKJwxiG4ZsL8om8eOTlzClWtzNoBvbyqP0O\\\"; session-token=GZ9fEfY09afC6U6bj83sUbKH7ODDgAj/dOCPLvuCREFyH8sOapKp5aUSuLwzx3GGyIpr2t8UQQEOTqBLHN1VeUOPx+5JDOJeP9i6rLBzjtfe46Lq/MWgxAnxD4Zo9yqtHV7C9upOC3+2964HqiQYwCdKob6jM4tT7CNmMzB+7ePbhMhBxyDFvfYC4KQowJg2fRr6hkM8vdDy5mZCOxX/T7Gf5z+gAlk/j8O4gnRtot88+AeCdhshuHpiVr2I7XbmCqszH/w9iwjFVXFt6UR6KBAjlTkHaKJYSKxv0ukfR5NfxL7f4zWKhzKxP3LrM4OdPXHpw16xKfL4EEyqHtzu878qvouJdTSEA9eu0I7+h7iEH2e3t97vWE47MFOrzKJC1YTGJPhiSW8=\"},\"userData\":{\"__crawlee\":{\"state\":4}},\"handledAt\":\"2026-01-18T14:16:26.687Z\"}",
4
+ "method": "GET",
5
+ "orderNo": null,
6
+ "retryCount": 0,
7
+ "uniqueKey": "https://httpbin.org/get",
8
+ "url": "https://httpbin.org/get"
9
+ }