Skip to content
On this page

Empower Your Test Results with AI-Powered Insights ->

setDefaultTimeout

sets default timeout of requests.

Defaults 3000 milliseconds

Syntax

js
setDefaultTimeout(milliseconds)

Usage

โœ… Correct Usage

js
request.setDefaultTimeout(5000)

Arguments

> milliseconds (number)

timeout in milliseconds.

Examples

Normal

js
const { spec, request } = require('pactum');

request.setDefaultTimeout(5000);

await spec()
  .get('https://randomuser.me/api')
  .expectStatus(200);

Released under the MIT License.