# Strange Mock Response Behavior

**URL:** <https://community.postman.com/t/strange-mock-response-behavior/21309>\
**Category:** Help Hub\
**Created:** [March 12, 2021, 2:49pm UTC](https://community.postman.com/t/strange-mock-response-behavior/21309 "2021-03-12T14:49:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjackvony](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kjackvony/32/5109_2.png) [@kjackvony](https://community.postman.com/u/kjackvony)\
**Post date:** [March 12, 2021, 2:49pm UTC](https://community.postman.com/t/strange-mock-response-behavior/21309/1 "2021-03-12T14:49:01Z")

</div>

Hello Postman friends! One of the developers at my company is seeing some strange behavior with mock requests. The problem is intermittent, so I’m wondering if there’s some kind of caching issue in addition to a potential bug.

The situation is this: we have a POST URL that includes two variables:  
{{BaseEnvironmentUri}}{{uriPrefix}}/Queue/StatusSummary  
The request itself works OK, but when he creates an example request with this URL and then uses it in a mock request, he gets this response:  
{  
“error”: {  
“name”: “mockRequestNotFoundError”,  
“message”: “Double check your method and the request path and try again.”,  
“header”: “No matching requests”  
}  
}

If he changes the example request to only use one variable, and uses the hard-coded value for the second variable, then he gets the correct mocked response.

However, this issue has been very difficult to reproduce, because I’m only seeing the problem intermittently. I’m wondering if the mocked response is being cached, so that there are times when I get the correct response when I’m using two variables, and there are times when I get the error response when I’m using one variable.

I’d love to find out if caching is causing the intermittent behavior, and if we do indeed have a bug here. Thanks!

---

<div class="post-metadata">

**Author:** ![kevin.swiber](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevin.swiber/32/3820_2.png) [@kevin.swiber](https://community.postman.com/u/kevin.swiber)\
**Post date:** [March 12, 2021, 4:04pm UTC](https://community.postman.com/t/strange-mock-response-behavior/21309/2 "2021-03-12T16:04:58Z")

</div>

Hi, @kjackvony!

I suspect what’s happening here is that the side-by-side variables, `{{BaseEnvironmentUri}}{{uriPrefix}}`, are getting matched against the base URL only (e.g., `https://<uuid>.mock.pstmn.io`) as there are no path separators. If your `uriPrefix` value is a path (e.g., `/v1`), this would essentially negate what you’re trying to accomplish with that variable.

I was able to reproduce this issue. One trick you can do here is to put a `/` between your variables in the request URL field of the example (e.g., `{{BaseEnvironmentUri}}/{{uriPrefix}}`. You _should_ be able to keep your variable values exactly as they are, and it should match just fine. This will force `uriPrefix` to match the first path segment.

Hope this helps.

Best,

Kevin

---

<div class="post-metadata">

**Author:** ![kjackvony](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kjackvony/32/5109_2.png) [@kjackvony](https://community.postman.com/u/kjackvony)\
**Post date:** [March 12, 2021, 4:51pm UTC](https://community.postman.com/t/strange-mock-response-behavior/21309/3 "2021-03-12T16:51:41Z")

</div>

Hi Kevin- Thanks for the swift response! The potential workaround of using the slashes between the variables didn’t work for us, but the dev seeing the issue feels a lot better that you were able to repro it and that you have explained what’s going on. 🙂
