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

Reusable Responses / Rules #939

Closed
Hrabal opened this issue Feb 2, 2023 · 1 comment
Closed

Reusable Responses / Rules #939

Hrabal opened this issue Feb 2, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists feature New feature request

Comments

@Hrabal
Copy link

Hrabal commented Feb 2, 2023

It would be useful to have a per-environment container of responses to re-use in multiple routes.

USE-CASE:
401 response returned by every endpoint of a service if no auth header is provided

ideal Mockoon config:

  • configure a single 401 response with the specific rule in the "Common Responses"
  • add a response in each route with a reference to the common one

Same thing would be useful for Rules:
USE-CASE:
basic params validation shared across several responses, but each response adds specific validation

ideal Mockoon config:

  • configure a single param rule (e.g: "page" should not be empty in queryString)
  • add a rule in some responses of type "Common" containing the reference of the common one, the common rule is executed when needed

Ideally this "common rules" implementation would also have the benefit to add some sort of "nested rules":

  • common rule 1: "page" in body AND "page_size" in body
  • common rule 2: "offset" in body AND "limit" in body
  • rule in the endpoint: common rule 1 OR common rule 2
@255kb 255kb added the feature New feature request label Feb 24, 2023
@255kb 255kb added the duplicate This issue or pull request already exists label Sep 22, 2023
@255kb
Copy link
Member

255kb commented Sep 22, 2023

I will close this issue as a duplicate of #221 and continue the discussion there.

@255kb 255kb closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants