Spring cloud gateway sample as a mock service
vforvikash opened this issue · 6 comments
Hello, @spencergibb
I have developed some code around Spring Cloud Gateway to allow gateway to act as a proxy to a service or provide mock data based on mock configuration.
I want to submit the same as a sample for gateway. Please let me know how can i do the same. Below are some details:
Is your feature request related to a problem? Please describe.
Needed a mock service based on proxy capability. The required mock service must be able to intercept incoming requests and return mock response if configured or forwards to existing live service.
Describe the solution you'd like
I have developed a framework on top of Spring Cloud Gateway to enable mock configuration based on properties/config service. This framework allows to add mock configuration for a given API endpoint. This mock API either produces mock response
or proxies the requests to live the service. The mock can be turned on/off for a given endpoint. It can also help to simulate difficult cases like timeouts for outbound calls by adding delays to mock response. Also, the mock configuration is property based which doesn’t require any modification.
Describe alternatives you've considered
There are few json-server which can be quickly configured and started. But it does not have a proxy capability.
Thanks & Regards,
Vikash
I'd say put it in your own repo
Thanks for your quick response @spencergibb. Is there any plan on adding other sample project in the future? is there a process to contribute like sample-gateway-oauth2login?
This org is for samples of features that are core to spring cloud and not for 3rd party extensions.
This org is for samples of features that are core to spring cloud and not for 3rd party extensions.
Thanks for your input @spencergibb. I have added the sample here https://github.com/ExpressScripts/sample-gateway-mock-apis. Just adding for reference.
Yes. I looked thru it very nice. I even reopened the feature request in gateway
Wow 🤩 Thanks a ton to check the sample.