Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@livelybone/easy-request
Advanced tools
Readme
pkg.module supported
, which means that you can apply tree-shaking in you project
A easy-to-use http request library to support all javascript runtime environments.
Feature list:
https://github.com/livelybone/easy-request.git
https://github.com/livelybone/easy-request#readme
Your can see the usage by run the example of the module, here is the step:
git clone https://github.com/livelybone/easy-request.git
cd your-module-directory
npm i
(use taobao registry: npm i --registry=http://registry.npm.taobao.org
)npm run dev
http://127.0.0.1:3000/examples/test.html
) in your browsernpm i -S @livelybone/easy-request
umd
bundleEasyRequest
See what method or params you can use in index.d.ts
import { Http, EngineName } from '@livelybone/easy-request'
const http = new Http(
EngineName.XHR,
{
baseURL: 'https://api.hostname.com',
responseType: 'json',
headers: { 'Content-Type': 'application/json' },
method: 'GET',
timeout: 30000,
withCredentials: false,
},
)
// interceptors
http.interceptors.request.use(config => {
const token = localStorage.getItem('token')
if (token) config.headers.Authorization = token
return config
})
http.interceptors.response.use(response => {
return response.data
})
const data = { param: '1' }
http.get('/api1').then(res => {
// ... do something
})
http.get('/api2', data, { responseType: 'text' }).then(res => {
// ... do something
})
http.post('/api2', data, {
responseType: 'text',
headers: { 'Content-Type': 'multipart/form-data' },
}).then(res => {
// ... do something
})
// ... other methods: put, delete, downloadFile, uploadFile
Use in html, see what your can use in CDN: unpkg
<-- use what you want -->
<script src="https://unpkg.com/@livelybone/easy-request/lib/umd/<--module-->.js"></script>
FAQs
A easy-to-use http request library to support all javascript runtime environments. 一个以支持所有JavaScript运行环境为目的、简单易用的http请求库。
The npm package @livelybone/easy-request receives a total of 29 weekly downloads. As such, @livelybone/easy-request popularity was classified as not popular.
We found that @livelybone/easy-request 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.