fetch-har 6.0.0 → 6.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/index.js +6 -3
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## <small>6.0.1 (2022-01-26)</small>
2
+
3
+ * fix: regression in query parameter handling (#242) ([6c6a147](https://github.com/readmeio/fetch-har/commit/6c6a147)), closes [#242](https://github.com/readmeio/fetch-har/issues/242)
4
+
5
+
6
+
7
+ ## <small>6.0.0 (2022-01-25)</small>
8
+
9
+ > **BREAKING CHANGE**
10
+ >
11
+ > With this release we no longer support the [form-data](https://npm.im/form-data) package as it's handling of `multipart/form-data` is non-compliant with the browser `FormData` API. Please use [formdata-node](https://npm.im/formdata-node) or [formdata-polyfill](https://npm.im/formdata-polyfill) instead.
12
+ >
13
+ > Additionally the optional `userAgent` option has been reworked into a new options object that also supports a new `files` mapping array for augmenting binaries or file uploads within a HAR with a file buffers or the `File` API. See the readme for documentation.
14
+
15
+ * fix: handling of multipart/form-data requests and how we interact with FormData ([#237](https://github.com/readmeio/fetch-har/pull/237))
16
+ * chore(deps-dev): bumping node-fetch ([#240]((https://github.com/readmeio/fetch-har/pull/240))
17
+ * fix: improper handling of query strings ([#239](https://github.com/readmeio/fetch-har/pull/239))
18
+ * feat: extending the new files option to allow overriding raw binary payloads ([#238](https://github.com/readmeio/fetch-har/pull/238))
19
+
20
+
21
+
22
+
1
23
  ## <small>5.0.5 (2022-01-03)</small>
2
24
 
3
25
  * chore: removing the publishConfig from the package file ([05df1e7](https://github.com/readmeio/fetch-har/commit/05df1e7))
package/index.js CHANGED
@@ -286,14 +286,17 @@ function constructRequest(har, opts = { userAgent: false, files: false, multipar
286
286
  }
287
287
  }
288
288
 
289
+ // We automaticaly assume that the HAR that we have already has query parameters encoded within it so we do **not**
290
+ // use the `URLSearchParams` API here for composing the query string.
289
291
  if ('queryString' in request && request.queryString.length) {
290
- const queryParams = new URL(url).searchParams;
292
+ const urlObj = new URL(url);
291
293
 
294
+ const queryParams = Array.from(urlObj.searchParams).map(([k, v]) => `${k}=${v}`);
292
295
  request.queryString.forEach(q => {
293
- queryParams.append(q.name, q.value);
296
+ queryParams.push(`${q.name}=${q.value}`);
294
297
  });
295
298
 
296
- querystring = queryParams.toString();
299
+ querystring = queryParams.join('&');
297
300
  }
298
301
 
299
302
  if (opts.userAgent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fetch-har",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Make a fetch request from a HAR definition",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -44,7 +44,7 @@
44
44
  "form-data": "^4.0.0",
45
45
  "form-data-encoder": "^1.7.1",
46
46
  "formdata-node": "^4.3.2",
47
- "har-examples": "^3.0.0",
47
+ "har-examples": "^3.1.0",
48
48
  "isomorphic-fetch": "^3.0.0",
49
49
  "mocha": "^9.1.4",
50
50
  "node-fetch": "^2.6.0",