Mokksy Server
Represents an embedded mock server capable of handling various HTTP requests and responses for testing purposes. Provides functionality to configure request specifications for different HTTP methods and manage request matching.
Parameters
The port number on which the server will run. Defaults to 0 (randomly assigned port).
Server configuration options
Determines whether the server startup process should block the current thread. Defaults to false.
A lambda function for setting custom configurations for the server's application module.
Constructors
Initializes the server with the specified parameters and starts it.
Functions
Checks for any unmatched requests by retrieving all request specifications that have not been matched to incoming requests and verifies that the list of unmatched requests is empty.
Configures an HTTP DELETE request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP DELETE request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP DELETE method to define the request specification within the provided lambda.
Executes an HTTP DELETE request with the specified configuration and request type.
Retrieves a list of all request specifications that have not been matched to any incoming requests. A request is considered unmatched if its match count is zero.
Configures HTTP GET request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP GET request specification using the provided block and returns a BuildingStep
instance for further customization.
Configures an HTTP HEAD request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP HEAD request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP HEAD method to define the request specification within the provided lambda.
Constructs a HEAD HTTP request with the provided configuration, request type, and specification block.
Creates a building step for a stub configuration with the specified parameters.
Creates a RequestSpecification
with the specified HTTP method and additional configuration defined by the given block, and returns a new BuildingStep
instance for further customization.
Configures an HTTP HEAD request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP OPTIONS request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP OPTIONS method to define the request specification within the provided lambda.
Configures and executes an HTTP OPTIONS request based on the given parameters.
Configures an HTTP PATCH request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP PATCH request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP PATCH method to define the request specification within the provided lambda.
Builds and returns a BuildingStep for a PATCH HTTP request with the provided configuration, request type, and custom request specification block.
Configures an HTTP POST request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP POST request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP POST method to define the request specification within the provided lambda.
Sends a POST request using the provided configuration, request type, and block to define the request specification.
Configures an HTTP PUT request specification using the provided block and returns a BuildingStep
for further customization. This method serves as a convenience shortcut.
Configures an HTTP PUT request specification using the provided block and returns a BuildingStep
instance for further customization. This method uses the HTTP PUT method to define the request specification within the provided lambda.
Executes an HTTP PUT request with the provided configuration and request specifications.
Resets the match counts for all mappings in the server. Each mapping's match count is set to zero, effectively clearing any record of previous matches.