fetch-har 8.1.0 → 8.1.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/CHANGELOG.md +6 -0
- package/dist/index.js +3 -6
- package/package.json +2 -3
- package/src/index.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## <small>8.1.1 (2022-07-27)</small>
|
|
2
|
+
|
|
3
|
+
* fix: swapping parse-data-url for @readme/data-urls (#307) ([a2306bd](https://github.com/readmeio/fetch-har/commit/a2306bd)), closes [#307](https://github.com/readmeio/fetch-har/issues/307)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
1
7
|
## 8.1.0 (2022-07-26)
|
|
2
8
|
|
|
3
9
|
* chore: code comment cleanup ([bd344f1](https://github.com/readmeio/fetch-har/commit/bd344f1))
|
package/dist/index.js
CHANGED
|
@@ -10,12 +10,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
exports.__esModule = true;
|
|
17
14
|
var readable_stream_1 = require("readable-stream");
|
|
18
|
-
var
|
|
15
|
+
var data_urls_1 = require("@readme/data-urls");
|
|
19
16
|
if (!globalThis.Blob) {
|
|
20
17
|
try {
|
|
21
18
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies
|
|
@@ -220,7 +217,7 @@ function fetchHAR(har, opts) {
|
|
|
220
217
|
}
|
|
221
218
|
else if ('value' in param) {
|
|
222
219
|
var paramBlob = void 0;
|
|
223
|
-
var parsed = (0,
|
|
220
|
+
var parsed = (0, data_urls_1.parse)(param.value);
|
|
224
221
|
if (parsed) {
|
|
225
222
|
// If we were able to parse out this data URL we don't need to transform its data
|
|
226
223
|
// into a buffer for `Blob` because that supports data URLs already.
|
|
@@ -275,7 +272,7 @@ function fetchHAR(har, opts) {
|
|
|
275
272
|
// If we've got `files` map content present, and this post data content contains a valid data
|
|
276
273
|
// URL then we can substitute the payload with that file instead of the using data URL.
|
|
277
274
|
if (opts.files) {
|
|
278
|
-
var parsed = (0,
|
|
275
|
+
var parsed = (0, data_urls_1.parse)(request.postData.text);
|
|
279
276
|
if (parsed) {
|
|
280
277
|
if ((parsed === null || parsed === void 0 ? void 0 : parsed.name) && parsed.name in opts.files) {
|
|
281
278
|
var fileContents = opts.files[parsed.name];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fetch-har",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "Make a fetch request from a HAR definition",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/readmeio/fetch-har#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@readme/data-urls": "^1.0.0",
|
|
33
34
|
"@types/har-format": "^1.2.8",
|
|
34
|
-
"parse-data-url": "^4.0.1",
|
|
35
35
|
"readable-stream": "^3.6.0"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"@types/mocha": "^9.1.1",
|
|
47
47
|
"@types/multer": "^1.4.7",
|
|
48
48
|
"@types/node": "^18.0.0",
|
|
49
|
-
"@types/parse-data-url": "^3.0.0",
|
|
50
49
|
"@types/readable-stream": "^2.3.13",
|
|
51
50
|
"chai": "^4.3.4",
|
|
52
51
|
"datauri": "^4.1.0",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Har } from 'har-format';
|
|
2
|
+
import type { DataURL as npmDataURL } from '@readme/data-urls';
|
|
2
3
|
import { Readable } from 'readable-stream';
|
|
3
|
-
import parseDataUrl from '
|
|
4
|
+
import { parse as parseDataUrl } from '@readme/data-urls';
|
|
4
5
|
|
|
5
6
|
if (!globalThis.Blob) {
|
|
6
7
|
try {
|
|
@@ -92,7 +93,7 @@ type FetchHAROptions = {
|
|
|
92
93
|
init?: RequestInit;
|
|
93
94
|
};
|
|
94
95
|
|
|
95
|
-
type DataURL =
|
|
96
|
+
type DataURL = npmDataURL & {
|
|
96
97
|
// `parse-data-url` doesn't explicitly support `name` in data URLs but if it's there it'll be
|
|
97
98
|
// returned back to us.
|
|
98
99
|
name?: string;
|