Skip to content
On this page

Empower Your Test Results with AI-Powered Insights ->

setDefaultExpectStatus

set default expect response status code for all the response assertions.

Syntax

js
setDefaultExpectStatus(statusCode)
  • statusCode (number) - response status code.

TIP

  • Reference guide for HTTP status codes: here.

Usage

โœ… Correct Usage

js
response.setDefaultExpectStatus(200)

Examples

Normal

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

response.setDefaultExpectStatus(200)

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

See Also

Released under the MIT License.