batch(requests: Request[], opt?: BatchOption): BatchResponse[]
Parameter | Type | Description |
requests | Array of request objects. | |
opt? | Optional; configuration options for batch initiation of requests. |
Type | Description |
Array of batch request results. |
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));}