File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -56,17 +56,17 @@ describe('APIRequester', () => {
56
56
} )
57
57
58
58
it ( 'handles baseURL with path and endpoint without leading slash' , async ( ) => {
59
- mockedAxios . get . mockResolvedValueOnce ( { data : null } ) ;
59
+ mockedAxios . get . mockResolvedValueOnce ( { data : null } )
60
60
61
- const request = new APIRequester ( 'https://rest.testnet.initia.xyz/bar' ) ;
62
- await request . get ( 'foo' ) ;
61
+ const request = new APIRequester ( 'https://rest.testnet.initia.xyz/bar' )
62
+ await request . get ( 'foo' )
63
63
64
64
expect ( mockedAxios . get ) . toHaveBeenCalledWith (
65
65
'https://rest.testnet.initia.xyz/bar/foo' ,
66
66
{
67
67
headers : new axios . AxiosHeaders ( ) ,
68
68
params : { } ,
69
69
}
70
- ) ;
71
- } ) ;
70
+ )
71
+ } )
72
72
} )
Original file line number Diff line number Diff line change @@ -52,15 +52,15 @@ export class APIRequester {
52
52
}
53
53
54
54
private computeEndpoint ( endpoint : string ) {
55
- const relativeEndpoint = endpoint . replace ( / ^ \/ + / , '' ) ;
56
- const baseURLObject = new URL ( this . baseURL ) ;
55
+ const relativeEndpoint = endpoint . replace ( / ^ \/ + / , '' )
56
+ const baseURLObject = new URL ( this . baseURL )
57
57
58
58
if ( ! baseURLObject . pathname . endsWith ( '/' ) ) {
59
- baseURLObject . pathname += '/' ;
59
+ baseURLObject . pathname += '/'
60
60
}
61
- baseURLObject . pathname += relativeEndpoint ;
61
+ baseURLObject . pathname += relativeEndpoint
62
62
63
- return baseURLObject . toString ( ) ;
63
+ return baseURLObject . toString ( )
64
64
}
65
65
66
66
public async getRaw < T > (
You can’t perform that action at this time.
0 commit comments