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

[Request] Ability to dynamically change status response code #29

Closed
crbanman opened this issue Apr 17, 2017 · 4 comments
Closed

[Request] Ability to dynamically change status response code #29

crbanman opened this issue Apr 17, 2017 · 4 comments

Comments

@crbanman
Copy link

I'm doing some basic parameter validation on one of my mocks and would like to be able to return a different status code when a parameter is missing or incorrect. Currently, the only way this can be done is to create a separate error response and select it using the UI.

@crbanman
Copy link
Author

Created a pull request with a potential solution. #30

@smollweide
Copy link
Owner

Hi @crbanman,
I created an middleware object which gives you the power to change the response.

The difference to your approach is that there is a new option in the ui to select "middleware" as response.
Will this approach be okay for you?

@crbanman
Copy link
Author

Hey @smollweide,
Your current solution does solve my problem.

It would be nice if each service could define their own middleware code inside the same directory as the other files for that service. But that's more of a "nice to have" feature as your current solution will work for me.

@smollweide
Copy link
Owner

Hi @crbanman,
it's released with in version 0.13.0

npm i node-mock-server@0.13.0 --save-dev

Thank you for your patience.

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

No branches or pull requests

2 participants