Skip to content

Commit

Permalink
Fix/cross fetch (#484)
Browse files Browse the repository at this point in the history
* fix: Cross Fetch

* chore: Add changeset
  • Loading branch information
rrr523 authored Feb 20, 2024
1 parent ec70921 commit a467c26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/bright-melons-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bnb-chain/greenfield-js-sdk': patch
---

fix: Using Cross Fetch replace native fetch (occurs on Nodejs 18-)
3 changes: 2 additions & 1 deletion packages/js-sdk/src/clients/spclient/spClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { parseError } from '@/clients/spclient/spApis/parseError';
import { SP_NOT_AVAILABLE_ERROR_CODE, SP_NOT_AVAILABLE_ERROR_MSG } from '@/constants/http';
import { AuthType, ReqMeta } from '@/types/auth';
import { fetchWithTimeout } from '@/utils/http';
import { injectable } from 'tsyringe';
import { getGetObjectMetaInfo } from './spApis/getObject';
import { getPutObjectMetaInfo } from './spApis/putObject';
Expand Down Expand Up @@ -55,7 +56,7 @@ export class SpClient implements ISpClient {
try {
const controller = new AbortController();
const _id = setTimeout(() => controller.abort(), timeout);
const response = await fetch(url, {
const response = await fetchWithTimeout(url, {
...options,
signal: controller.signal,
});
Expand Down

0 comments on commit a467c26

Please sign in to comment.