Skip to content

Commit

Permalink
Merge pull request #22 from tiagosiebler/statuscodes
Browse files Browse the repository at this point in the history
v1.0.11: fix() status codes 202-204 should not throw exception
  • Loading branch information
tiagosiebler authored Jul 30, 2024
2 parents f886341 + b18f105 commit 567ff0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit 567ff0a

Please sign in to comment.