Request Specification
open class RequestSpecification<P : Any>(val method: Matcher<HttpMethod>? = null, val path: Matcher<String>? = null, val headers: List<Matcher<Headers>> = listOf(), val body: List<Matcher<P?>> = listOf(), val bodyString: List<Matcher<String?>> = listOf(), val priority: Int = DEFAULT_STUB_PRIORITY, requestType: KClass<P>)(source)
Represents a specification for matching incoming HTTP requests based on defined criteria, such as HTTP method, request path, and request body.
This class is used to define the criteria against which incoming requests are tested. It provides functionality for checking whether a given request satisfies the specified conditions and supports prioritization for defining matching order.
Parameters
P
type of the request payload
Properties
Link copied to clipboard
List of matchers for the request body as a String. All matchers must pass for a match to succeed.
Link copied to clipboard
Matcher for the HTTP method of the request. If null, the method is not validated.
Link copied to clipboard
The priority value used for comparing different specifications. Lower values indicate higher priority. Default value is DEFAULT_STUB_PRIORITY