jamesdbloom/mockserver-grunt

Using wildcard to match requests

GiritharanR opened this issue · 1 comments

I am trying to match the SOAP webservices request body to set the expectations.

My web services request content is too long to have all the values in the expectation. Is it possible to use wildcard approach with regex to match the pattern?

If yes, could you please provide an example for the same?

Yes it is definitely possible to do that, please see the documentation at http://www.mock-server.com/mock_server/creating_expectations.html#request_matchers for full details.

"httpRequest": {
    "method": "POST",
    "path": "/login",
    "queryStringParameters": [
        {
            "name": "returnUrl",
            "values": ["/account"]
        }
    ],
    "cookies": [
        {
            "name": "sessionId",
            "values": ["2By8LOhBmaW5nZXJwcmludCIlMDAzMW"]
        }
    ],
    "body": {
        "type": "REGEX",
        "value": "username[a-z]{4}"
    }
}