可以获得一些http的methods
一、支持环境
支持node环境和浏览器环境
(已通过测试√)
二、node环境使用 npm install --save @parrotjs/http-methods //安装npm包
const methods=require('@parrotjs/http-methods');
console.log(methods);/** [
'acl', 'bind', 'checkout',
'connect', 'copy', 'delete',
'get', 'head', 'link',
'lock', 'm-search', 'merge',
'mkactivity', 'mkcalendar', 'mkcol',
'move', 'notify', 'options',
'patch', 'post', 'propfind',
'proppatch', 'purge', 'put',
'rebind', 'report', 'search',
'source', 'subscribe', 'trace',
'unbind', 'unlink', 'unlock',
'unsubscribe'
]**/
三、浏览器环境使用
(已通过测试√)
1.HTML中使用 //使用upk在线cdn
https://unpkg.com/@parrotjs/http-methods@1.4.0/browser.js
//使用jsdelivr在线cdn
https://cdn.jsdelivr.net/npm/@parrotjs/http-methods@1.4.0/browser.js
//index.html
<!DOCTYPE html>
<html>
<head>Test</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@parrotjs/http-methods@1.4.0/browser.js"></script>
<script>
console.log(HTTPMETHODS())
//["get", "post", "put", "head", "delete", "options", "trace", "copy", "lock", "mkcol", "move", "purge", "propfind", "proppatch", "unlock", "report", "mkactivity", "checkout", "merge", "m-search", "notify", "subscribe", "unsubscribe", "patch", "search", "connect"]
</script>
</body>
</html>
(已通过测试√)
2.ESM中使用 import httpmethods from '@parrotjs/http-methods'
console.log(httpmethods())
四、github源码地址
https://github.com/parrot-design/parrot-utils/tree/main/httpmethods
五、版本变更记录
- 1.0.0 初始化目录
- 1.1.0 修改md文件
- 1.2.0 添加浏览器支持
- 1.3.0 添加浏览器支持