Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock Server request fails with 404 when using header x-mock-response-code #11485

Closed
1 task done
bhuvanmehra opened this issue Nov 25, 2022 · 2 comments
Closed
1 task done

Comments

@bhuvanmehra
Copy link

Is there an existing issue for this?

  • I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

When requesting a response from the mock server endpoint, I am passing the x-api-key.
My endpoint has an example saved which has status code 200 OK.

When I try to access it using header x-mock-response-name: refData, it works.
However when I try to access it using header x-mock-response-code: 200, it returns a 404 error -

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

image

Steps To Reproduce

  1. Create a mock-server
  2. Make it private
  3. Generate an API Key
  4. create and endpoint in the mock server's collection
  5. save an example to that endpoint named refData with response code as 200 OK
  6. Access that endpoint with the following 2 headers -
    x-api-key:xxx and x-mock-response-name: refData
    It works.
  7. Change one if the headers from x-mock-response-name: refData to
    x-mock-response-code: 200
  8. You get the above mentioned error.

Screenshots or Videos

No response

Operating System

Mac OS

Postman Version

10.0.42

Postman Platform

Postman App

Additional Context?

No response

@saket-ranjan-010
Copy link

Hi @bhuvanmehra , I am sorry to see that you are not able to use mock servers. I tried out all the steps to reproduce this error and it seems to be working fine for me. I have a hunch there might be some other matching criteria that's getting applied to your mock request that's not evident here. Can you share the collection json with me so I can determine what exactly is causing the error?

Meanwhile here's some additional information that might help you in getting a successful mock response via additional headers: https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/mock-with-api/. Let me know if this works for you.

@saket-ranjan-010
Copy link

Hey @bhuvanmehra , I hope my response helped you in resolving the issue you were facing. I'm closing this issue for now since there hasn't been any update from your end. Feel free to reopen this issue if you face any problems with the same flow again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants