Using the local mock server

I’m new to Stoplight studio and I am currently using the desktop version. I am using the built-in local mock server to test the APIs. I click on the “Mock Server” button in the bottom right of the UI and it shows me the list of APIs I can call. All my APIs at the moment only have POST methods, no GET methods. When I go to click on one of the APIs and I get an error message error response.
{“type”:“",“title”:"Route resolved, but no method matched”,“status”:405,“detail”:“The route /api/v1/learning/meal-event-detection has been matched, but it does not have “get” method defined”}

Basically 405 error that No method matched. If I add a GET method to my API then everything works fine. It seems when using the local mock server in this way, it only looks for GET methods on the API. Is that true? And if so, is there a way to configure it such that it will use only the methods that are present.

In addition, if I go through the “Try It” capability I have no issue as I can specify which HTTP verb to use.

Hello @ancyss.merisanu this is as expected as you were probably just clicking the link and opening a tab in your browser on a POST method. To take full advantage of the mock server go to “Try It” in the preview next to “Docs”. In this request maker go to ‘Mocking’ and ‘Enable Mocking’. You can now send correct requests to this endpoint and get back a response:

You can also use the code generation next to Mocking to help you write correct requests for your client. In the bottom example using HTTPie notice that I get the same error message when using GET on a POST method (same as with your browser):


But I get a correct response when I make a POST request to that endpoint:

This is the standard error that you are getting:

To summarize, make sure that you are making a POST request on a POST endpoint to get the expected response.