Show HN: Kool-Fetch – A Lightweight Fetch Wrapper with Axios-Like Interceptors(github.com)
github.com
Show HN: Kool-Fetch – A Lightweight Fetch Wrapper with Axios-Like Interceptors
https://github.com/Thomascogez/kool-fetch
0 コメント
—
https://github.com/Thomascogez/kool-fetch
—
I’m excited to share kool-fetch, a lightweight (~8kb, 0 dependencies) fetch wrapper I built to simplify HTTP requests in JavaScript. It brings axios-like request and response interceptors to the native fetch API, cutting down on boilerplate code.
Key features:
- Interceptors: Modify requests (e.g., add auth headers) or responses (e.g., handle 401 errors) with ease. - Response Unwrapping: Simplify parsing with .unwrap("json") for typed JSON, text, or arrayBuffer. - Customizable Error Handling: Throw on HTTP errors with custom error messages. - Native Fetch Compatibility: Use it like fetch, with optional baseURL and default configs.