jawad
jawad

Reputation: 825

Postman does not accept `-` as an URI param for mocking server requests

I get the following error response:

{
    "error": {
        "name": "mockRequestNotFoundError",
        "header": "No matching requests",
        "message": "Double check your method and the request path and try again."
    }
}

When I pass - as an URI param for a Postman request created via a mocking server unlike when I pass the same URI param value in a request not created via a mocking server it's working well!

URL: http://{{host}}/order/{{subUserId}}/{{BusinessDate}}/5

host: {mocking-server-url-without-http-keyword}

subUserId: 1

BusinessDate: 2020-01-12-17-07-21

HTTP request header: x-api-key : {{postman_secret_API_key}}

The main request by using the mocking server as a host which returns data correctly:

enter image description here

The mocked request by using the mocking server as a host which returns an error:

enter image description here

Upvotes: 3

Views: 7101

Answers (1)

Danny Dainton
Danny Dainton

Reputation: 25881

The mock example would need to match the path of the main request for it to be returned.

For example:

enter image description here

If it doesn't, it wouldn't be able to find the mock example that you're using:

enter image description here

I'm unsure of your particular context but you could also use different Request Headers on your main request to point to specific mock examples:

x-mock-response-code:200
x-mock-response-name:<name of the mock example>

Upvotes: 3

Related Questions