got 15.0.5 → 15.0.6

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.
@@ -701,6 +701,8 @@ export type PaginationOptions<ElementType, BodyType> = {
701
701
 
702
702
  It should return an object representing Got options pointing to the next page. The options are merged automatically with the previous request, therefore the options returned `pagination.paginate(...)` must reflect changes only. If there are no more pages, `false` should be returned.
703
703
 
704
+ When pagination navigates to a different origin, Got strips inherited sensitive headers such as `authorization`, `cookie`, and `proxy-authorization`. If you trust the next-page URL and want to forward a sensitive header, return it explicitly from `pagination.paginate(...)`.
705
+
704
706
  @example
705
707
  ```
706
708
  import got from 'got';
@@ -1006,7 +1006,8 @@ export default class Options {
1006
1006
  updated = new URLSearchParams(value);
1007
1007
  }
1008
1008
  else if (value instanceof URLSearchParams) {
1009
- updated = value;
1009
+ // Clone so the caller-owned object is not stored by reference.
1010
+ updated = new URLSearchParams(value);
1010
1011
  }
1011
1012
  else {
1012
1013
  validateSearchParameters(value);
@@ -1037,10 +1038,11 @@ export default class Options {
1037
1038
  }
1038
1039
  }
1039
1040
  else if (url) {
1040
- url.search = searchParameters.toString();
1041
+ // Overrides the query string in the URL.
1042
+ url.search = updated.toString();
1041
1043
  }
1042
1044
  else {
1043
- this.#internals.searchParams = searchParameters;
1045
+ this.#internals.searchParams = updated;
1044
1046
  }
1045
1047
  }
1046
1048
  get searchParameters() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "got",
3
- "version": "15.0.5",
3
+ "version": "15.0.6",
4
4
  "description": "Human-friendly and powerful HTTP request library for Node.js",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/got",