fauxrpc icon indicating copy to clipboard operation
fauxrpc copied to clipboard

Add CEL rules for stubs

Open sudorandom opened this issue 1 year ago • 0 comments

It would be neat if you could specify CEL rules that would decide if a stub is used. Like if you're stubbing a GET call, you could have a stub that looks like this:

id: "user1234"
target: my.v1.app.UserService/getUser
rules:
 - req.id == "1234"
json: {...}

Then when you call my.v1.app.UserService/getUser looking for the user with id 1234 you would receive the given mocked response. This would allow fairly complex testing scenarios.

Also, for debugging purposes the selected stub ID should be returned as a return header value.

sudorandom avatar Oct 13 '24 14:10 sudorandom