File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
packages/gatsby-source-drupal/src Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ const _ = require(`lodash`)
3
3
const urlJoin = require ( `url-join` )
4
4
import HttpAgent from "agentkeepalive"
5
5
// const http2wrapper = require(`http2-wrapper`)
6
- const url = require ( `url` )
7
- const querystring = require ( `querystring` )
8
6
9
7
const { HttpsAgent } = HttpAgent
10
8
@@ -391,21 +389,13 @@ exports.sourceNodes = async (
391
389
`queueing ${ requestsCount } API requests for type ${ d . body . data [ 0 ] . type } which has ${ d . body . meta . count } entities.`
392
390
)
393
391
if ( d . body . links . next ?. href ) {
394
- const parsedUrl = url . parse ( d . body . links . next ?. href )
395
- const parsedQueryString = querystring . parse ( parsedUrl . query )
396
392
await Promise . all (
397
393
_ . range ( requestsCount ) . map ( pageOffset => {
398
394
pageOffset += 1
399
- // Construct query string.
400
- const newQuerystring = {
401
- ...parsedQueryString ,
402
- "page[offset]" : pageOffset * 50 ,
403
- }
404
- const newUrl = url . format ( {
405
- ...parsedUrl ,
406
- search : querystring . stringify ( newQuerystring ) ,
407
- } )
408
- return getNext ( newUrl )
395
+ // Construct URL with new pageOffset.
396
+ const newUrl = new URL ( d . body . links . next . href )
397
+ newUrl . searchParams . set ( `page[offset]` , pageOffset * 50 )
398
+ return getNext ( newUrl . toString ( ) )
409
399
} )
410
400
)
411
401
}
You can’t perform that action at this time.
0 commit comments