@crawlee/core 4.0.0-beta.215 → 4.0.0-beta.217

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.215",
3
+ "version": "4.0.0-beta.217",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.13.0"
@@ -53,14 +53,14 @@
53
53
  "@apify/log": "^3.0.1",
54
54
  "@apify/timeout": "^1.0.1",
55
55
  "@apify/utilities": "^3.0.1",
56
- "@crawlee/fs-storage": "4.0.0-beta.215",
57
- "@crawlee/http-client": "4.0.0-beta.215",
58
- "@crawlee/types": "4.0.0-beta.215",
59
- "@crawlee/utils": "4.0.0-beta.215",
56
+ "@crawlee/fs-storage": "4.0.0-beta.217",
57
+ "@crawlee/http-client": "4.0.0-beta.217",
58
+ "@crawlee/types": "4.0.0-beta.217",
59
+ "@crawlee/utils": "4.0.0-beta.217",
60
60
  "@sapphire/async-queue": "^1.5.5",
61
61
  "@standard-schema/spec": "^1.0.0",
62
62
  "@vladfrangu/async_event_emitter": "^2.4.6",
63
- "content-type": "^1.0.5",
63
+ "content-type": "^3.1.1",
64
64
  "csv-stringify": "^6.5.2",
65
65
  "json5": "^2.2.3",
66
66
  "mime-types": "^3.0.1",
@@ -76,5 +76,5 @@
76
76
  }
77
77
  }
78
78
  },
79
- "gitHead": "48766c0c661a9c152fedfd08706f7418b3735d73"
79
+ "gitHead": "419bbc19902f65caf584ddfb0f26a901f5f157c4"
80
80
  }
@@ -1,4 +1,4 @@
1
- import contentTypeParser from 'content-type';
1
+ import { isTypeValid, parse as parseContentType } from 'content-type';
2
2
  import JSON5 from 'json5';
3
3
  import { jsonStringifyExtended } from '@apify/utilities';
4
4
  import { isBuffer, isStream } from '../byte_utils.js';
@@ -67,17 +67,12 @@ export function parseValue(body, contentTypeHeader) {
67
67
  // No content type at all → we have no basis for interpretation; hand back the raw value.
68
68
  if (contentTypeHeader === null)
69
69
  return body;
70
- let contentType;
71
- let charset;
72
- try {
73
- const result = contentTypeParser.parse(contentTypeHeader);
74
- contentType = result.type;
75
- charset = result.parameters.charset;
76
- }
77
- catch {
78
- // Unparseable header → keep the original value rather than a mangled string.
70
+ const result = parseContentType(contentTypeHeader);
71
+ // Unparseable header → keep the original value rather than a mangled string.
72
+ if (!isTypeValid(result.type))
79
73
  return body;
80
- }
74
+ const contentType = result.type;
75
+ const charset = result.parameters.charset;
81
76
  // If we can't successfully interpret it, we return the original value rather than mangling it.
82
77
  if (!areDataStringifiable(contentType, charset))
83
78
  return body;