# Why does Postman picks a lesser example response over a better matching one?

**URL:** <https://community.postman.com/t/why-does-postman-picks-a-lesser-example-response-over-a-better-matching-one/11972>\
**Category:** Help Hub\
**Created:** [April 15, 2020, 3:54pm UTC](https://community.postman.com/t/why-does-postman-picks-a-lesser-example-response-over-a-better-matching-one/11972 "2020-04-15T15:54:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjeefr](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sjeefr](https://community.postman.com/u/sjeefr)\
**Post date:** [April 15, 2020, 3:54pm UTC](https://community.postman.com/t/why-does-postman-picks-a-lesser-example-response-over-a-better-matching-one/11972/1 "2020-04-15T15:54:26Z")

</div>

I’ve read the [Matching Algorithm](https://learning.postman.com/docs/postman/mock-servers/matching-algorithm/) page a few times, but still don’t understand why Postman picks a lesser response over a more matching one. Let me clarify with images.

 ![Schermafbeelding 2020-04-15 om 17.47.08](https://us1.discourse-cdn.com/getpostman/original/3X/5/f/5fe46eb9c9c7452b854e2f1de4c761f1dc87b9c4.png)  
_^^ This is my request. It has three parameters and will remain this way. It’s nothing special_

 ![Schermafbeelding 2020-04-15 om 17.49.46](https://us1.discourse-cdn.com/getpostman/original/2X/f/f291b0ce1a80a8013d94f3b0ca08b76582072936.png)  
_^^ This is example response 1, where both page and limit parameters match. Not using CompanyId as this can vary in the actual application. The response that includes a example request isn’t special either._

 ![Schermafbeelding 2020-04-15 om 17.59.09](https://us1.discourse-cdn.com/getpostman/original/2X/d/d5dc82d83291005b8f149d16458b6dcd456a0367.png)  
_^^ This is example response #2 that only on page parameter differs from response #1 - and on this parameter not matching with the actual request_

Whilst both responses are identical to each other and the request, with the difference of the ?page parameter, Postman still picks the one that matches slightly less.

I want to mock pagination in the application by using different responses, based on first- or second page (parameter). Apparently I’m unable to do so.

Can someone help me out?

---

<div class="post-metadata">

**Author:** ![Kurmavatar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kurmavatar/32/3026_2.png) [@Kurmavatar](https://community.postman.com/u/Kurmavatar)\
**Post date:** [April 20, 2020, 4:50am UTC](https://community.postman.com/t/why-does-postman-picks-a-lesser-example-response-over-a-better-matching-one/11972/2 "2020-04-20T04:50:52Z")

</div>

Hi @sjeefr

You wouldn’t be able to retrieve the mock response just by changing the page parameters in your requests. This behavior can only be expected when you have your mock example responses defined in the same manner. Here is one GitHub thread that explains on how the example responses are fetched when you have an identical endpoints.

> <https://github.com/postmanlabs/postman-app-support/issues/8065>
>
> \*\*Describe the bug\*\*
> While using a the x-mock-match-request-headers against my …mock server, the default response is not returned when nothing is passed in the header.
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Set up a mock server with 3 examples. 
> a. Default example. Response should be 
> 
> \`\`\`
> {
> number:default
> }
> 
> \`\`\`
> \<img width="523" alt="default" src="https://user-images.githubusercontent.com/2584258/74553381-dd60ab00-4f1c-11ea-85f0-6d2789eb71e2.png"\>
> 
> b. Example ONE. key: values of number:one is set for the header. Response should be 
> 
> \`\`\`
> {
> number:one
> }
> \`\`\`
> 
> \<img width="637" alt="one" src="https://user-images.githubusercontent.com/2584258/74553336-c3bf6380-4f1c-11ea-8b13-d6ef7340c7bc.png"\>
>    
> c. example named TWO when a key: values of number:two is set for the header. Response should be 
> 
> \`\`\`
> {
> number:two
> }
> \`\`\`
> 
> \<img width="592" alt="two" src="https://user-images.githubusercontent.com/2584258/74553354-ce79f880-4f1c-11ea-8ec1-b5760cfd9c99.png"\>
> 
> 2. Send the request with the different header parameters: 
> number: one | two  
> x-mock-match-request-headers: number
> 
> \<img width="656" alt="Screen Shot 2020-02-14 at 11 29 29 AM" src="https://user-images.githubusercontent.com/2584258/74553576-4e07c780-4f1d-11ea-9632-1369581b5386.png"\>
> This works correctly.
> 
> 3. Send the request without any header parameters 
> 
> \<img width="656" alt="Screen Shot 2020-02-14 at 11 29 29 AM" src="https://user-images.githubusercontent.com/2584258/74553733-8effdc00-4f1d-11ea-9b91-0a567650648e.png"\>
> 
> and the response is the example when the header value is one: 
> 
> \`\`\`
> {
> number:one
> }
> \`\`\`
> 
> \*\*Expected behavior\*\*
> When nothing is passed in the header, the default response would return. 
> 
> I have made a couple videos that I can share to illustrate the issue.

Also, here is a mock collection that can be imported into the app - which explains various ways to use the mock in your responses. Hope this helps! 🙂

> **[Mock Requests](https://documenter.getpostman.com/view/6034746/SWT8gK1f?version=latest)**
>
> To try mocking the responses in every possible way with use of headers and params.
