Interceptors are just wrappers in disguise.
const myfetch = async (req, options) => {
let options = options || {};
options.headers = options.headers || {};
options.headers['Authorization'] = token;
let res = await fetch(new Request(req, options));
if (res.status == 401) {
// do your thing
throw new Error("oh no");
}
return res;
}
Convenience is a thing, but it doesn't require a massive library.but it does for massive DDoS :p
That fetch requires so many users to rewrite the same code - that was already handled well by every existing node HTTP client- says something about the standards process.