New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

isomorphic-fetch-http

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isomorphic-fetch-http

react fetch by isomorphic-fetch

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-82.35%
Maintainers
1
Weekly downloads
 
Created
Source

isomorphic-fetch-http

NPM version NPM downloads

Install

npm install isomorphic-fetch-http --save

Usage

Use prebuilt bundle

import { http } from 'isomorphic-fetch-http'

// 全局配置
http.setup({
  prefix: '/api',               // url 前缀
  header: {},                   // 自定义请求头
  exception: ['INVALIDError']   // 自定义捕获类型
});

// 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);

Contributing

You can submit any ideas as pull requests or as a Github issue.

Keywords

FAQs

Package last updated on 06 Jul 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc