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

Add capability to send a custom default response #32

Closed
shubhendumadhukar opened this issue May 15, 2021 · 0 comments
Closed

Add capability to send a custom default response #32

shubhendumadhukar opened this issue May 15, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@shubhendumadhukar
Copy link
Contributor

Is your feature request related to a problem? Please describe.
In cases Camouflage can not find a mockfile for an invoked endpoint, it sends following default response

{
    "error": "Not Found"
}

User should, however, be able to override this default response with custom default responses at global level and at the API level.

Describe the solution you'd like
Implementation as follows:

  1. User invokes a GET call to /default/error/response
  2. Corresponding mock file is evaluated as ${MOCK_DIR}/default/error/response/GET.mock
  3. Camouflage can not find the mock file, however it finds a directory ${MOCK_DIR}/default
  4. Camouflage determines ${MOCK_DIR}/default/__/GET.mock as the closest match for the invoked API.
  5. Camouflage looks for an API level default response in the closest match.
  6. If above mock file too, is unavailable, Camouflage looks for a global default response ${MOCK_DIR}/__/GET.mock
  7. Finally, if all determined mock files are unavailable, Camouflage sends its inbuilt default response as shown above.

Describe alternatives you've considered
NA

Additional context
NA

@shubhendumadhukar shubhendumadhukar added the enhancement New feature or request label May 15, 2021
@shubhendumadhukar shubhendumadhukar self-assigned this May 15, 2021
@shubhendumadhukar shubhendumadhukar added this to To do in Camouflage Issue Tracker via automation May 15, 2021
@shubhendumadhukar shubhendumadhukar moved this from To do to Testing in Camouflage Issue Tracker May 15, 2021
Camouflage Issue Tracker automation moved this from Testing to Closed May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant