【文件属性】:
文件名称:http:fetch API 的便捷包装器
文件大小:3.19MB
文件格式:ZIP
更新时间:2021-08-03 11:21:03
fetch http JavaScript
@ianwalter/http
API 的便捷包装器
安装
pnpm add @ianwalter/http
用法
import { http } from '@ianwalter/http'
// Add a new header to the global http instance.
http . options . headers = { 'csrf-token' : 'abc123' }
// Send a POST request with some data.
const response = await http . post ( '/api/thing' , { body : { complete : true } } )
拦截请求和响应
http . after = ( url , init , response ) => ( {
... response
【文件预览】:
http-main
----empty.js(103B)
----index.js(4KB)
----package.json(1KB)
----pnpm-lock.yaml(217KB)
----.changeset()
--------README.md(512B)
--------config.json(260B)
----.github()
--------FUNDING.yml(18B)
--------workflows()
----tests()
--------config.js(1KB)
--------snapshots()
--------tests.pptr.js(3KB)
--------fixtures()
----LICENSE(2KB)
----.gitignore(23B)
----CHANGELOG.md(161B)
----.npmrc(24B)
----README.md(994B)