tencent cloud

Performance Testing Service

http.batch

PDF
Focus Mode
Font Size
Last updated: 2025-03-10 17:04:46
http.batch is used to initiate HTTP requests in batch.
batch(requests: Request[], opt?: BatchOption): BatchResponse[]

Parameters

Parameter
Type
Description
requests
Array of request objects.
opt?
Optional; configuration options for batch initiation of requests.

Return

Type
Description
Array of batch request results.

Samples

Initiate batch requests:
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));
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback