多种实现 | Multiple Implementations
支持 Fetch 和 Axios 两种实现,可根据需求自由切换。Supports both Fetch and Axios implementations, switch freely based on your needs.
模块化、可扩展的现代 HTTP 请求库 | A modern, modular, and extensible HTTP request library
npm install @ureq/core @ureq/impl-fetchpnpm add @ureq/core @ureq/impl-fetchyarn add @ureq/core @ureq/impl-fetchimport { Request } from '@ureq/core';
import { FetchRequestor } from '@ureq/impl-fetch';
// 创建请求实例
const request = new Request(new FetchRequestor({
baseURL: 'https://api.example.com'
}));
// 发起请求
const data = await request.get('/users/1');
console.log(data);