Request Matcher

Mockgee's Request Matcher stands as a robust method for configuring diverse mock responses, leveraging criteria such as request headers, payload, and query parameters.

This powerful feature enhances response customization for comprehensive and precise simulation of various scenarios.

Path Params

Mockgee supports the configuration of path parameters and fetch mock response data accordingly.

Here's an example of how to set path parameters in the URL of an API mock:

For path /api/user/{userId}, sets userId = 100 (Mock Response 1) and userId = 101 (Mock Response 2)

At runtime, if path is /api/user/100 - Mockgee returns Mock Response 1 and if path is /api/user/101 - it retuns Mock Response 2

Note: If no exact value matches, Mockeee randomly returns mock response for any userId value

Query String

Mockgee enables you to configure multiple mock responses with static and dynamic query string values in your API mock URL, and accurately deliver the appropriate mock response during runtime.

Static Query String

A static query string matches an exact key-value pair at runtime and returns the corresponding mock response payload.

Dynamic Query String

A dynamic query string matches any keys and values in the URL and returns the configured mock response payload.

Here's an example of setting a dynamic query string using an asterisk:

If your API endpoint is: https://example.com/api/users?status=active&page=1

You can configure a dynamic query string by setting the URL as follows:

https://example.com/api/users?*"

This configuration would match any query string parameters and return the corresponding mock response payload.

Headers

Mockgee allows flexible setup of multiple responses based on varying request header values, providing concise control for diverse testing scenarios.

Payload

Full payload match

In this option, Mockgee meticulously matches the complete payload, ensuring the return of the corresponding response with exactness and precision.

Match specific Field

The Mockgee Match Request Filter condition is a feature that allows you to select particular fields from the request data and only compare those fields to return an appropriate mock response.

For example, if you have configured two mock samples for an endpoint - POST/api/v1/account and choose to apply a match filter condition on id field on the JSON request payload. Here instead of matching the whole request JSON payload, it will only match id field and ignores all other fields (name, dept, and type) and return the appropriate mock response.

request payload 1
{ 
    "id": 100, 
    "name": "Tanveer", 
    "dept": "IT",
    "type": "Contract"
}
request payload 2
{ 
    "id": 100, 
    "name": "Iqbal", 
    "dept": "Finance",
    "type": "Permament"
}
response payload
{ 
    "result": "ok",
    "code": 0
}

Ignore Specific Field

The Mockgee Ignore Filter condition lets you remove specific fields from the request data and matches the remaining fields. The ignore filter condition is the opposite of match filter.

For example, if you have configured two mock samples for an endpoint - POST/api/v1/account and choose to apply a ignore filter condition on field id and name. At runtime it ignores id and name and matches only rest of fields (dept and type).

request payload 1
{ 
    "id": 100, 
    "name": "Tanveer", 
    "dept": "IT",
    "type": "Contract"
}
request payload 2
{ 
    "id": 200, 
    "name": "Iqbal", 
    "dept": "IT",
    "type": "Contract"
}
response payload
{ 
    "result": "ok",
    "code": 0
}

Ignore all

The Mockgee Ignore All Filter operates by completely disregarding any filtering conditions related to the payload, and instead, promptly delivers the predefined mock response. This represents a form of static mocking condition, where the system consistently responds with the predetermined mock data, without taking into account any dynamic factors from the payload.

Take a moment to explore this convenient tool and see what it has to offer.