@fetchkit/ffetch 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,14 +114,13 @@ try {
|
|
|
114
114
|
|
|
115
115
|
Native `fetch`'s controversial behavior of not throwing errors for HTTP error status codes (4xx, 5xx) can lead to overlooked errors in applications. By default, `ffetch` follows this same pattern, returning a `Response` object regardless of the HTTP status code. However, with the `throwOnHttpError` flag, developers can configure `ffetch` to throw an `HttpError` for HTTP error responses, making error handling more explicit and robust. Note that this behavior is affected by retries and the circuit breaker - full details are explained in the [Error Handling documentation](./docs/errorhandling.md).
|
|
116
116
|
|
|
117
|
-
```typescript
|
|
118
|
-
|
|
119
117
|
## Documentation
|
|
120
118
|
|
|
121
119
|
| Topic | Description |
|
|
122
120
|
| --------------------------------------------- | ------------------------------------------------------------------------- |
|
|
123
121
|
| **[Complete Documentation](./docs/index.md)** | **Start here** - Documentation index and overview |
|
|
124
122
|
| **[API Reference](./docs/api.md)** | Complete API documentation and configuration options |
|
|
123
|
+
| **[Error Handling](./docs/errorhandling.md)** | Strategies for managing errors, including `throwOnHttpError` |
|
|
125
124
|
| **[Advanced Features](./docs/advanced.md)** | Per-request overrides, pending requests, circuit breakers, custom errors |
|
|
126
125
|
| **[Hooks & Transformation](./docs/hooks.md)** | Lifecycle hooks, authentication, logging, request/response transformation |
|
|
127
126
|
| **[Usage Examples](./docs/examples.md)** | Real-world patterns: REST clients, GraphQL, file uploads, microservices |
|
|
@@ -141,12 +140,11 @@ You can pass any fetch-compatible implementation (native fetch, node-fetch, undi
|
|
|
141
140
|
|
|
142
141
|
#### "AbortSignal.any is not a function"
|
|
143
142
|
|
|
144
|
-
|
|
143
|
+
Solution: Install a polyfill for `AbortSignal.any`
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
```bash
|
|
147
146
|
npm install abort-controller-x
|
|
148
|
-
|
|
149
|
-
````
|
|
147
|
+
```
|
|
150
148
|
|
|
151
149
|
## CDN Usage
|
|
152
150
|
|
|
@@ -157,7 +155,7 @@ npm install abort-controller-x
|
|
|
157
155
|
const api = createClient({ timeout: 5000 })
|
|
158
156
|
const data = await api('/api/data').then((r) => r.json())
|
|
159
157
|
</script>
|
|
160
|
-
|
|
158
|
+
```
|
|
161
159
|
|
|
162
160
|
## Fetch vs. Axios vs. `ffetch`
|
|
163
161
|
|
|
@@ -176,8 +174,8 @@ npm install abort-controller-x
|
|
|
176
174
|
|
|
177
175
|
## Contributing
|
|
178
176
|
|
|
179
|
-
- **Issues**: [GitHub Issues](https://github.com/
|
|
180
|
-
- **Pull Requests**: [GitHub PRs](https://github.com/
|
|
177
|
+
- **Issues**: [GitHub Issues](https://github.com/fetch-kit/ffetch/issues)
|
|
178
|
+
- **Pull Requests**: [GitHub PRs](https://github.com/fetch-kit/ffetch/pulls)
|
|
181
179
|
- **Documentation**: Found in `./docs/` - PRs welcome!
|
|
182
180
|
|
|
183
181
|
## License
|