![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
modelproxy-engine-fetch
Advanced tools
Readme
使用fetch来调用接口的engine。
npm i modelproxy-engine-fetch
import { FetchEngine } from 'modelproxy-engine-fetch';
const reactEngine = new FetchEngine();
reactEngine.init();
/**
* 请求真正的数据接口
* 判断http的状态码,如果不是200,直接抛出错误
* 判断数据的code字段,如果不是200,抛出错误
* 返回数据
*/
reactEngine.use(async (ctx, next) => {
if (ctx.result.status !== 200) {
throw new Error(ctx.result.statusText);
}
// 这里需要clone一个fetch,不然多次调用会报错(body stream already read)
ctx.result = await ctx.result.clone();
// 检测服务器端的错误
const serData = await ctx.result.json();
if (serData.code !== 200) {
throw new Error(serData.message);
}
await next();
});
const proxy = new modelProxy.Proxy();
const proxyDefault = { engine: "react", mockDir: "/mock", state: __DEV__ ? "dev" : "prod" };
proxy.addEngines({"react":reactEngine});
MIT
FAQs
modelproxy中fetch的engine
We found that modelproxy-engine-fetch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.