@@ -425,21 +425,21 @@ export interface PaginationOptions<ElementType, BodyType> {
425
425
const limit = 10;
426
426
427
427
const items = got.paginate('https://example.com/items', {
428
- searchParameters : {
428
+ searchParams : {
429
429
limit,
430
430
offset: 0
431
431
},
432
432
pagination: {
433
433
paginate: ({response, currentItems}) => {
434
- const previousSearchParams = response.request.options.searchParameters ;
434
+ const previousSearchParams = response.request.options.searchParams ;
435
435
const previousOffset = previousSearchParams.get('offset');
436
436
437
437
if (currentItems.length < limit) {
438
438
return false;
439
439
}
440
440
441
441
return {
442
- searchParameters : {
442
+ searchParams : {
443
443
...previousSearchParams,
444
444
offset: Number(previousOffset) + limit,
445
445
}
@@ -707,10 +707,10 @@ const defaultInternals: Options['_internals'] = {
707
707
maxHeaderSize : undefined ,
708
708
} ;
709
709
710
- const cloneInternals = ( internals : typeof defaultInternals ) : typeof defaultInternals => {
710
+ const cloneInternals = ( internals : typeof defaultInternals ) => {
711
711
const { hooks, retry} = internals ;
712
712
713
- const result = {
713
+ const result : typeof defaultInternals = {
714
714
...internals ,
715
715
context : { ...internals . context } ,
716
716
cacheOptions : { ...internals . cacheOptions } ,
@@ -732,7 +732,7 @@ const cloneInternals = (internals: typeof defaultInternals): typeof defaultInter
732
732
beforeRetry : [ ...hooks . beforeRetry ] ,
733
733
afterResponse : [ ...hooks . afterResponse ] ,
734
734
} ,
735
- searchParameters : internals . searchParams ? new URLSearchParams ( internals . searchParams as URLSearchParams ) : undefined ,
735
+ searchParams : internals . searchParams ? new URLSearchParams ( internals . searchParams as URLSearchParams ) : undefined ,
736
736
pagination : { ...internals . pagination } ,
737
737
} ;
738
738
@@ -1176,10 +1176,10 @@ export default class Options {
1176
1176
@example
1177
1177
```
1178
1178
await got('https://example.com/?query=a b'); //=> https://example.com/?query=a%20b
1179
- await got('https://example.com/', {searchParameters : {query: 'a b'}}); //=> https://example.com/?query=a+b
1179
+ await got('https://example.com/', {searchParams : {query: 'a b'}}); //=> https://example.com/?query=a+b
1180
1180
1181
- // The query string is overridden by `searchParameters `
1182
- await got('https://example.com/?query=a b', {searchParameters : {query: 'a b'}}); //=> https://example.com/?query=a+b
1181
+ // The query string is overridden by `searchParams `
1182
+ await got('https://example.com/?query=a b', {searchParams : {query: 'a b'}}); //=> https://example.com/?query=a+b
1183
1183
```
1184
1184
*/
1185
1185
get url ( ) : string | URL | undefined {
@@ -1312,11 +1312,11 @@ export default class Options {
1312
1312
```
1313
1313
import got from 'got';
1314
1314
1315
- const searchParameters = new URLSearchParams([['key', 'a'], ['key', 'b']]);
1315
+ const searchParams = new URLSearchParams([['key', 'a'], ['key', 'b']]);
1316
1316
1317
- await got('https://example.com', {searchParameters });
1317
+ await got('https://example.com', {searchParams });
1318
1318
1319
- console.log(searchParameters .toString());
1319
+ console.log(searchParams .toString());
1320
1320
//=> 'key=a&key=b'
1321
1321
```
1322
1322
*/
0 commit comments