Skip to content

Commit

Permalink
fix: Response object mapping on timeout (#26)
Browse files Browse the repository at this point in the history
* fix: Response object mapping on timeout

* docs: updates README
  • Loading branch information
aleortega authored May 16, 2023
1 parent b695e97 commit ef72930
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# base-ts-project
# fetch-component

Use this project as template for TypeScript libraries
`fetch-component` is a well-known component that provides a wrapper around the `cross-fetch` library with support for retries. It simplifies making HTTP requests with retry logic and timeout handling.

## Installation

```bash
npm install @well-known-components/fetch-component
```
2 changes: 1 addition & 1 deletion src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function fetchWithRetriesAndTimeout(
fetchPromise,
new Promise((resolve, _) => {
timeoutSignal!.addEventListener('abort', () => {
resolve(new Response('timeout', { status: 408, statusText: 'Request Timeout' }))
resolve(new crossFetch.Response('timeout', { status: 408, statusText: 'Request Timeout' }))
})
})
])
Expand Down

0 comments on commit ef72930

Please sign in to comment.