Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.11: fix() status codes 202-204 should not throw exception #22

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/*",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/BaseRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' &&
Expand Down