在 RunJS 中发起带认证的 HTTP 请求的方法。请求会自动携带当前应用的 baseURL、Token、Cookies 等。
RequestOptions 在 Axios 的 AxiosRequestConfig 基础上扩展:
url、method、params、data 等),URL 可使用资源风格(如 users:list、posts:update)。| 参数 | 类型 | 说明 |
|---|---|---|
url | string | 请求 URL,可为资源风格如 users:list、posts:update |
method | 'get' | 'post' | 'put' | 'patch' | 'delete' | HTTP 方法,默认 'get' |
params | object | 查询参数,会序列化到 URL |
data | any | 请求体,用于 post/put/patch |
headers | object | 自定义请求头 |
skipNotify | boolean | (error) => boolean | 为 true 或函数返回 true 时,失败不弹出全局错误提示 |
skipAuth | boolean | 为 true 时请求失败(如 401)不触发认证跳转(如跳转登录页) |
使用完整 URL 请求其他域名的接口,目标服务需配置 CORS 允许当前应用来源。