All Projects → werk85 → Fetch Intercept

werk85 / Fetch Intercept

Licence: mit
Interceptor library for the native fetch command inspired by angular http intercepts.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Fetch Intercept

rsfetch
A WIP rewrite of rsfetch from scratch.
Stars: ✭ 33 (-88.17%)
Mutual labels:  fetch
node-fetch-cookies
node-fetch wrapper that adds support for cookie-jars
Stars: ✭ 15 (-94.62%)
Mutual labels:  fetch
wxapp-api-interceptors
微信小程序api拦截器
Stars: ✭ 99 (-64.52%)
Mutual labels:  interceptor
re-frame-fetch-fx
js/fetch Effect Handler for re-frame
Stars: ✭ 24 (-91.4%)
Mutual labels:  fetch
fastfetch
Like neofetch, but much faster because written in c. Only Linux.
Stars: ✭ 191 (-31.54%)
Mutual labels:  fetch
Aspect4Delphi
Concepts of aspect-oriented programming (AOP) in Delphi.
Stars: ✭ 28 (-89.96%)
Mutual labels:  interceptor
kras
Efficient server proxying and mocking in Node.js. 💪
Stars: ✭ 18 (-93.55%)
Mutual labels:  interceptor
Abortcontroller Polyfill
Polyfill for the AbortController DOM API and abortable fetch (stub that calls catch, doesn't actually abort request).
Stars: ✭ 273 (-2.15%)
Mutual labels:  fetch
meros
🪢 A fast utility that makes reading multipart responses simple
Stars: ✭ 109 (-60.93%)
Mutual labels:  fetch
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (-83.87%)
Mutual labels:  fetch
RetryRequestInterceptor-for-OkHttp
a interceptor for OkHttp which can save failed request in storage and will retry request until success or retry times over limit , or request live time over limit
Stars: ✭ 42 (-84.95%)
Mutual labels:  interceptor
http4s-dom
http4s, in a browser near you
Stars: ✭ 13 (-95.34%)
Mutual labels:  fetch
swr-examples
SWR is a React Hook library for remote data fetching. Here are some simple examples.
Stars: ✭ 14 (-94.98%)
Mutual labels:  fetch
fetchx
Beautiful way to fetch data in React
Stars: ✭ 71 (-74.55%)
Mutual labels:  fetch
Trae
📮 Minimalistic Fetch based HTTP client
Stars: ✭ 257 (-7.89%)
Mutual labels:  fetch
node-blog-app
🌐 A node+espress+mongoose+react+nextjs blog
Stars: ✭ 12 (-95.7%)
Mutual labels:  fetch
redux-things
Redux things | Fast and easy data synchronization for Redux
Stars: ✭ 12 (-95.7%)
Mutual labels:  fetch
Turbo
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Stars: ✭ 275 (-1.43%)
Mutual labels:  interceptor
Thwack
A tiny modern data fetching solution
Stars: ✭ 268 (-3.94%)
Mutual labels:  fetch
fetch
Simple system info fetch for Linux
Stars: ✭ 15 (-94.62%)
Mutual labels:  fetch

fetch-intercept

Build Status

Interceptor library for the native fetch command inspired by angular http interceptors.

fetch-intercept monkey patches the global fetch method and allows you the usage in Browser, Node and Webworker environments.

Installation

npm install fetch-intercept --save

Usage

Note: You need to require fetch-intercept before you use fetch the first time.

Make sure you have a fetch compatible environment or added a appropriate polyfill.

import fetchIntercept from 'fetch-intercept';

const unregister = fetchIntercept.register({
    request: function (url, config) {
        // Modify the url or config here
        return [url, config];
    },

    requestError: function (error) {
        // Called when an error occured during another 'request' interceptor call
        return Promise.reject(error);
    },

    response: function (response) {
        // Modify the reponse object
        return response;
    },

    responseError: function (error) {
        // Handle an fetch error
        return Promise.reject(error);
    }
});

// Call fetch to see your interceptors in action.
fetch('http://google.com');

// Unregister your interceptor
unregister();

React-Native Compatibility

Support react-native 0.17 or higher versions.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].