@@ -79,9 +79,13 @@ function sleep(ms: number): Promise<void> {
7979 return new Promise ( ( r ) => setTimeout ( r , ms ) )
8080}
8181
82- async function safeGet < T > ( client : AxiosInstance , url : string ) : Promise < T | null > {
82+ async function safeGet < T > (
83+ client : AxiosInstance ,
84+ url : string ,
85+ params ?: Record < string , string > ,
86+ ) : Promise < T | null > {
8387 try {
84- const res = await client . get < T > ( url )
88+ const res = await client . get < T > ( url , { params } )
8589 return res . data
8690 } catch ( err ) {
8791 if ( axios . isAxiosError ( err ) ) {
@@ -92,9 +96,9 @@ async function safeGet<T>(client: AxiosInstance, url: string): Promise<T | null>
9296 const wait = reset ? Math . max ( 0 , Number ( reset ) * 1000 - Date . now ( ) ) + 1000 : 60_000
9397 console . warn ( ` Rate limited — waiting ${ Math . round ( wait / 1000 ) } s` )
9498 await sleep ( wait )
95- return safeGet < T > ( client , url )
99+ return safeGet < T > ( client , url , params )
96100 }
97- console . warn ( ` HTTP ${ status } for ${ url . replace ( / ( [ ? & ] a p i _ k e y = ) [ ^ & ] + / , '$1[redacted]' ) } ` )
101+ console . warn ( ` HTTP ${ status } for ${ url } ` )
98102 }
99103 return null
100104 }
@@ -198,7 +202,8 @@ async function getLibIoRepoUrl(groupId: string, artifactId: string): Promise<str
198202 if ( ! LIBRARIES_IO_KEY ) return null
199203 const data = await safeGet < LibIoPackage > (
200204 libIo ,
201- `/maven/${ encodeURIComponent ( `${ groupId } :${ artifactId } ` ) } ?api_key=${ LIBRARIES_IO_KEY } ` ,
205+ `/maven/${ encodeURIComponent ( `${ groupId } :${ artifactId } ` ) } ` ,
206+ { api_key : LIBRARIES_IO_KEY } ,
202207 )
203208 return data ?. repository_url ?? null
204209}
0 commit comments