No results for

Powered byAlgolia

batch( requests )

suggest edits

Batch multiple HTTP requests together, to issue them in parallel over multiple TCP connections.

requestsarrayAn array containing requests, in string or object form
params (optional)objectadditional parameters for all requests in the batch


arrayAn array containing Response objects.


import { Httpx, Get } from '';
import { describe } from '';
let session = new Httpx({ baseURL: '' });
export default function () {
describe('01. Fetch public crocodiles all at once', (t) => {
let responses = session.batch([
new Get('/public/crocodiles/1/'),
new Get('/public/crocodiles/2/'),
new Get('/public/crocodiles/3/'),
new Get('/public/crocodiles/4/'),
], {
tags: {name: 'PublicCrocs'}
responses.forEach(response => {
t.expect(response.status).as("response status").toEqual(200)
.and(response.json('age')).as('croc age').toBeGreaterThan(7);