Gatling’s check system validates response data and optionally captures values into the virtual user’s session for use in subsequent requests. The HTTP module provides a set of built-in check targets that cover the full range of HTTP response attributes — from the status code and response headers to the final URL after redirects and the full response body. HTTP-specific checks compose with the sameDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/gatling/gatling.io-doc/llms.txt
Use this file to discover all available pages before exploring further.
is, not, in, exists, notExists, saveAs, and name operators available to all Gatling checks.
Status Code
Target the HTTP response status code withstatus(). The most common use is asserting an exact value, but you can also use in, not, and saveAs.
Page Location
currentLocation
Targets the absolute URL of the final page after all redirects have been followed. Useful for verifying that redirects land on the expected destination.
currentLocationRegex
Applies a Java regular expression to the final URL. Use captureGroups(n) when your pattern contains multiple capture groups; the result is a List of the captured strings.
HTTP Headers
header
Targets a single response header by name. The check succeeds if the header is present and passes all applied conditions. The header name parameter accepts static strings, Gatling EL strings, and functions.
headerRegex
Applies a Java regular expression to a specific response header’s value. Use captureGroups(n) to extract multiple groups.
Body Checks
Body checks are part of the core Gatling check system and are fully usable on HTTP responses. The following extractors are available:regex
Applies a Java regular expression to the response body string. Supports
find, findAll, findRandom, and count.xpath
Evaluates an XPath expression on XML or HTML response bodies. Supports namespace declarations.
jsonPath
Evaluates a JSONPath expression on JSON response bodies using the Jayway library.
jmesPath
Evaluates a JMESPath expression on JSON response bodies using the JMESPath Java library.
css
Applies a CSS selector (jQuery-style) to HTML response bodies. Can target element attributes.
bodyString
Captures the entire response body as a String.
bodyBytes
Captures the entire response body as a byte array.
bodyLength
Captures the response body length in bytes as an integer.
Body Check Examples
- regex
- jsonPath
- css
- xpath
- bodyString / bodyBytes
Combining Multiple Checks
You can chain multiple checks on a single request. All checks must pass for the request to be considered successful.Protocol-Level Checks
Checks can also be defined on theHttpProtocol with .check(checks...) to apply them to every request in the scenario. Individual requests can override this with ignoreProtocolChecks.
See the HTTP Protocol reference for how to attach checks to the protocol builder.