From d2e1d823a8f5bd797b632c1099822e8e3e0a25fc Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Tue, 30 Jul 2024 09:52:21 +0100 Subject: [PATCH 1/2] feat(): accept all gate success status codes --- src/lib/BaseRestClient.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/BaseRestClient.ts b/src/lib/BaseRestClient.ts index 1950b5a..867b801 100644 --- a/src/lib/BaseRestClient.ts +++ b/src/lib/BaseRestClient.ts @@ -245,7 +245,8 @@ export abstract class BaseRestClient { // Dispatch request return axios(options) .then((response) => { - if (response.status == 200 || response.status == 201) { + // See: https://www.gate.io/docs/developers/apiv4/en/#return-format + if (response.status >= 200 && response.status <= 204) { // Throw API rejections by parsing the response code from the body if ( typeof response.data?.code === 'number' && From b18f105b86d625fc2844e2e1ed3aad575b5e964d Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Tue, 30 Jul 2024 09:53:01 +0100 Subject: [PATCH 2/2] v1.0.11: fix() exceptions for successful 204 status --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4bd4cea..f288f6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gateio-api", - "version": "1.0.10", + "version": "1.0.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gateio-api", - "version": "1.0.10", + "version": "1.0.11", "license": "MIT", "dependencies": { "axios": "^1.6.6", diff --git a/package.json b/package.json index 50ce40e..09ebb33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gateio-api", - "version": "1.0.10", + "version": "1.0.11", "description": "Complete & robust Node.js SDK for Gate.io's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.", "scripts": { "clean": "rm -rf dist/*",