batch(requests: Request[], opt?: BatchOption): BatchResponse[]
参数 | 类型 | 描述 |
requests | 请求对象数组 | |
opt? | 可选,批量发起请求的配置选项 |
类型 | 描述 |
批量请求结果数组 |
import http from 'pts/http';export default function () {const responses = http.batch([{method: 'GET',url: 'http://httpbin.org/get?a=1',headers: { a: '1, 2, 3' },query: { b: '2' },},{method: 'GET',url: 'http://httpbin.org/get?a=1',headers: { a: '1, 2, 3' },query: { b: '2' },},]);console.log(JSON.stringify(responses));}
文档反馈