DEV Community

Discussion on: How to Mock a RESTful Microservice

Collapse
 
mafflerbach profile image
mafflerbach

Just a question. How to deal with big responses? Is it possible to us a file instead?

Collapse
 
clivern profile image
Clivern

Yes, you can use files content as response in case of big response. like the following

        {
            "path": "/api/v2/service2/mock/:id",
            "request": {
                "method": "get",
                "parameters": {
                    "var_param": ":var_param",
                    "fixed_param": 10
                }
            },
            "response": {
                "statusCode": 200,
                "headers": [
                    {"key": "Content-Type", "value": "application/json"}
                ],
                "body": "@json:@config_dir/route.response.json"
            },
            "chaos": {
                "latency": "0s",
                "failRate": "0%"
            }
        }
Enter fullscreen mode Exit fullscreen mode

check this example too github.com/Clivern/Rhino/tree/mast...