@landerqi/http
v0.0.1
Published
http 模块,基于axios / jsonp 封装请求方法
Downloads
1
Readme
@landerqi/http
Install
yarn add @lanerqi/http --registry=https://registry.npmjs.org
Usage
The usage is the same as Axios
import http from '@landerqi/http'
http.get(url[, config])
http.post(url[, data[, config]])
http.jsonp(url[, data[, config]])
Advanced usage: Create http instance
import { createHttp } from '@landerqi/http'
const httpOption = {
baseURL: '', // base url
timeout: 5000, // time out
// axios Unique field: more info: https://github.com/axios/axios
headers: {}, // Set header information
// jsonp
callbackKey: 'callback', // Parameter name that carries the name of the callback function
callbackPrefix: '__jp', // Callback function name prefix
callbackName: '', // Callback function name
}
const http = createHttp(httpOption)