Skip to content

Commit

Permalink
Apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
joon9823 committed Nov 27, 2024
1 parent f247aee commit 0ebeba3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/client/rest/APIRequester.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ describe('APIRequester', () => {
})

it('handles baseURL with path and endpoint without leading slash', async () => {
mockedAxios.get.mockResolvedValueOnce({ data: null });
mockedAxios.get.mockResolvedValueOnce({ data: null })

const request = new APIRequester('https://rest.testnet.initia.xyz/bar');
await request.get('foo');
const request = new APIRequester('https://rest.testnet.initia.xyz/bar')
await request.get('foo')

expect(mockedAxios.get).toHaveBeenCalledWith(
'https://rest.testnet.initia.xyz/bar/foo',
{
headers: new axios.AxiosHeaders(),
params: {},
}
);
});
)
})
})
10 changes: 5 additions & 5 deletions src/client/rest/APIRequester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export class APIRequester {
}

private computeEndpoint(endpoint: string) {
const relativeEndpoint = endpoint.replace(/^\/+/, '');
const baseURLObject = new URL(this.baseURL);
const relativeEndpoint = endpoint.replace(/^\/+/, '')
const baseURLObject = new URL(this.baseURL)

if (!baseURLObject.pathname.endsWith('/')) {
baseURLObject.pathname += '/';
baseURLObject.pathname += '/'
}
baseURLObject.pathname += relativeEndpoint;
baseURLObject.pathname += relativeEndpoint

return baseURLObject.toString();
return baseURLObject.toString()
}

public async getRaw<T>(
Expand Down

0 comments on commit 0ebeba3

Please sign in to comment.