FayFetch
1.0.0
https://github.com/p32929/fayfetch
一个简单的包装器(https://www.npmjs.com/package/node-fetch)
与您的朋友分享只有一键距离这里
如果您喜欢我的作品并想支持我/我的作品,请随时支持或捐赠。我的付款详细信息可以在此处找到:https://p32929.github.io/sendmoney2me/
看看这个例子
const { FayFetch } = require('fayfetch')
// or
import {FayFetch} from 'fayfetch'
var body = {
"username": "p32929",
"password": "password"
}
var params = {
"param1": "param1",
"param2": "param2",
}
var headers = {
"header1": "header1"
}
//
const url = "https://api.npoint.io/4d142c7ac93099c77456"
const callback = (status, jsonData, ok) => {
if (ok) {
// Success
}
else {
// error
}
}
//
FayFetch.get(url, params, headers, callback);
//
FayFetch.post(url, params, headers, body, callback);
//
FayFetch.put(url, params, headers, body, callback);
//
FayFetch.deletee(url, params, headers, callback);
//
FayFetch.upload(url, params, fileKeyString, fileObj, callback);
//
FayFetch.uploadUsingFormData(url, params, formData, callback);
MIT License
Copyright (c) 2020 Fayaz Bin Salam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.