Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Change error mock to be more lenient #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Potherca
Copy link
Contributor

@Potherca Potherca commented Aug 24, 2024

This MR makes it possible for the Error Mock middleware to accept nested path and paths without trailing slash.

Currently, only paths exactly matching /xxx/ are caught. This MR adds support for /xxx, /n/xxx and /n/xxx/.

Obviously, tests have been added to verify this new behaviour.

@poef
Copy link
Owner

poef commented Aug 26, 2024

What is the use case for /nested/500/ matching? (Or any other error code after any initial path)

@Potherca
Copy link
Contributor Author

The use-case is:

  • When a developer wants to use a different domain for consistency with other test/debug calls1, such a domain might contain a non-root URL for status codes2

Footnotes

  1. For instance https://httpbin.org/

  2. For instance https://httpbin.org/status/500

@Potherca
Copy link
Contributor Author

Discussed offline: the "trigger" should be unique-ish, this would also allow it to be nested. To make it uniquely idnetifiable /STATUS_xxx should be used, for instance https://example.com/whatever/STATUS_4000.

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

Successfully merging this pull request may close these issues.

2 participants