From d70360f0042739b990272c3b31edd6a787d2d333 Mon Sep 17 00:00:00 2001 From: mjadach-iv <104129084+mjadach-iv@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:59:54 +0100 Subject: [PATCH] getTicketPrice.ts-GET (#141) --- src/api/network/getTicketPrice.spec.ts | 10 +++++----- src/api/network/getTicketPrice.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/network/getTicketPrice.spec.ts b/src/api/network/getTicketPrice.spec.ts index 49b55a89..a890ffba 100644 --- a/src/api/network/getTicketPrice.spec.ts +++ b/src/api/network/getTicketPrice.spec.ts @@ -12,7 +12,7 @@ describe('test pingPeer', function () { }); it('handles successful response', async function () { nock(API_ENDPOINT) - .post(`/api/v3/network/price`) + .get(`/api/v3/network/price`) .reply(200, { price: '1000000' } as GetTicketPriceResponseType); @@ -25,7 +25,7 @@ describe('test pingPeer', function () { expect(response.price).toEqual('1000000'); }); it('throws a custom error when hoprd api response is an 400 error', async function () { - nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(400, { + nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(400, { status: 'INVALID_PEERID' }); @@ -37,7 +37,7 @@ describe('test pingPeer', function () { ).rejects.toThrow(sdkApiError); }); it('throws a custom error when hoprd api response is an 401 error', async function () { - nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(401, { + nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(401, { status: 'string', error: 'string' }); @@ -50,7 +50,7 @@ describe('test pingPeer', function () { ).rejects.toThrow(sdkApiError); }); it('throws a custom error when hoprd api response is an 403 error', async function () { - nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(403, { + nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(403, { status: 'string', error: 'string' }); @@ -63,7 +63,7 @@ describe('test pingPeer', function () { ).rejects.toThrow(sdkApiError); }); it('throws a custom error when hoprd api response is an 422 error', async function () { - nock(API_ENDPOINT).post(`/api/v3/network/price`).reply(422, { + nock(API_ENDPOINT).get(`/api/v3/network/price`).reply(422, { status: 'UNKNOWN_FAILURE', error: 'Full error message.' }); diff --git a/src/api/network/getTicketPrice.ts b/src/api/network/getTicketPrice.ts index 70b88906..25e78ef6 100644 --- a/src/api/network/getTicketPrice.ts +++ b/src/api/network/getTicketPrice.ts @@ -14,7 +14,7 @@ export const getTicketPrice = async ( const rawResponse = await fetchWithTimeout( `${apiEndpointParsed}api/v3/network/price`, { - method: 'POST', + method: 'GET', headers: getHeaders(payload.apiToken) }, payload.timeout