(url)
| 2839 | } |
| 2840 | |
| 2841 | function parseQueryString(url) { |
| 2842 | const queryString = url.split('?')[1] //获取查询字符串部分 |
| 2843 | const regex = /([^=&]+)=([^&]*)/g //匹配键值对的正则表达式 |
| 2844 | const params = {} |
| 2845 | let match |
| 2846 | |
| 2847 | while ((match = regex.exec(queryString))) { |
| 2848 | const key = decodeURIComponent(match[1]) //解码键 |
| 2849 | const value = decodeURIComponent(match[2]) //解码值 |
| 2850 | params[key] = value //将键值对添加到对象中 |
| 2851 | } |
| 2852 | |
| 2853 | return params |
| 2854 | } |
| 2855 | // 请求 |
| 2856 | async function http(url, opts = {}) { |
| 2857 | const http_start = Date.now() |
no outgoing calls
no test coverage detected