diff --git a/CHANGELOG.md b/CHANGELOG.md index 164d12ea5..dadd74912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T # Unreleased +- Remove request URLs forward slash append + # 1.4.0 (2024-01-08) - Omit `"build" | "simulate" | "submit"` from `aptos` namespace diff --git a/src/client/core.ts b/src/client/core.ts index 346e249c3..cf7df73a6 100644 --- a/src/client/core.ts +++ b/src/client/core.ts @@ -68,7 +68,7 @@ export async function aptosRequest( aptosConfig: AptosConfig, ): Promise> { const { url, path } = options; - const fullUrl = `${url}/${path ?? ""}`; + const fullUrl = path ? `${url}/${path}` : url; const response = await request({ ...options, url: fullUrl }, aptosConfig.client); const result: AptosResponse = { diff --git a/tests/e2e/client/aptosRequest.test.ts b/tests/e2e/client/aptosRequest.test.ts index c3fd5ced8..2f22654aa 100644 --- a/tests/e2e/client/aptosRequest.test.ts +++ b/tests/e2e/client/aptosRequest.test.ts @@ -338,7 +338,7 @@ describe("aptos request", () => { ); } catch (error: any) { expect(error).toBeInstanceOf(AptosApiError); - expect(error.url).toBe(`${NetworkToIndexerAPI[config.network]}/`); + expect(error.url).toBe(`${NetworkToIndexerAPI[config.network]}`); expect(error.status).toBe(200); expect(error.statusText).toBe("OK"); expect(error.data).toHaveProperty("errors");