{{url}}/knockknock cannot be used as a mock server endpoint

Hi,
I have been using postman and mock servers for a while now, but today I was attempting demonstrate the use of mock servers to some of my peers. I decided to take a trivial example to quickly set up and demonstrate.

Unfortunately I decided to use the protocol of the knock-knock joke as an example.
I found that in the Postman client if you send a GET request to {{url}}/knockknock this is treated as a special case and automatically returns:
{
“response”: “Who is there?”
}
The request therefore never hits my mock server call log.

I can’t find this feature documented and would like to know if there are any other special cases I should steer clear of when doing training sessions with colleagues.

Hi @shaun.williams!

Welcome to the community! :clap:

From what you are saying, it sounds like you should be able to get it working just fine. However, I am not sure of the details of how you set up the mock server. Care to go over those here so we can trouble shoot?

As a preemptive test, can you possibly try hitting other mock server endpoints hosted by Postman? Just to ensure its not a connection issue.

Best,
Orest

Hi @odanylewycz,
thanks for taking time to respond to my topic :+1:
To clarify, I have no issues in general with mock servers and using them so there is no connectivity issue.
The issue is that if i setup a mock server with a path of knockknock.
I get a collection with a new GET request with an endpoint of :
{{url}}/knockknock

If i create an example for this request that just sends back a plain text body of (without the quotes present in the body):
“Aw man! not these terrible jokes again”

When I hit the send button on the Get request, I receive a 200 response as expected, but:

  1. the response body is not text body of “Aw man!..” as expected, but instead a JSON body of {“response”: “Who is there?”}
  2. when I look at the mock sever logs there is no call to the mock server.

However, If I make a change to my request and example (mock response) to put a typo in the path, for example change {{url}}/knockknock to {{url}}/knocknock (notice only single K in the middle of the path); then my request hits my mock server and gives my expected text body response of “Aw man…”.

This shows that Postman has a sense of humour :laughing: and has purposely coded this behaviour, but since it is undocumented (as far as I can tell) it took me a while to understand what was going on and hence my question, are there any other undocumented features that I should avoid?

I hope this clarifies?

Hi @shaun.williams,

You’re welcome! My apologies for misunderstanding, I do understand better now, so thanks for the clarity. I missed a couple points before :joy:

From my experience with Postman, they surely do have a sense of humor, as a little gotcha. So looks like that request is being redirected, but maybe you can use the hyphenated knock-knock in your url, (unless that also returns a predetermined “Whos There”) response as well.

Other than that, I dont personally know of any behavior to avoid so you dont encounter undocumented features, or the little Easter Eggs Postman dev team leaves behind haha :laughing:.

@danny-dainton Do you know of any other Easter Eggs the OP can avoid? Or are those top secret? :grin:

1 Like