Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
isomorphic-fetch-http
Advanced tools
npm install isomorphic-fetch-http --save
import { http } from 'isomorphic-fetch-http'
// 全局配置
http.setup({
prefix: '/api', // url 前缀
header: {}, // 自定义请求头
filter: () => false // 自定义过滤器 发生在请求执行之前
callback: data => data // 数据请求成功之后的回调函数
});
http.setHeader({ // 覆盖/新增 请求头
token: ''
})
// get方法 一般用于查询
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.get('url', param, header);
// post方法 一般用于数据提交
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.post('url', param, header);
// put方法 一般用于数据修改
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.put('url', param, header);
// delete方法 一般用于数据删除
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.delete('url', param, header);
// json方法 本质是请求头为 "Content-Type": "application/json" 的post方法
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.json('url', param, header);
// option方法 本质是请求头为 "Content-Type": "application/json" 的post方法
// WARNING: 在isomorphic-fetch-http 1.0.0版本及以上版本,option方法已经由json方法代替,option方法将在1.1.0版本中去除
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.option('url', param, header);
// options方法 一般用于请求时的预检
// @param {Object} param
// @param {Object} header
// @return {Object} {status, data, message}
return http.options('url', param, header);
You can submit any ideas as pull requests or as a Github issue.
FAQs
react fetch by isomorphic-fetch
We found that isomorphic-fetch-http 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.