dreamhead / moco

Easy Setup Stub Server
MIT License
4.35k stars 1.08k forks source link

希望能支持响应json直接使用模板语法 #342

Open BBYL-github opened 9 months ago

BBYL-github commented 9 months ago
[
  {
    "description": "Identity verification",
    "request": {
      "method": "POST",
      "uri": "/1001"
    },
    "response": {
      "text": {
        "template": "{\"transNo\":\"${req.json.transNo}\",\"transDate\":\"${req.json.transDate}\",\"resultCode\":\"00000\",\"bizContent\":{\"insFlag\":\"Y\"}}"
      }
    }
  }
]

这个配置是起作用的,但能否也支持以下配置方式:

[
  {
    "description": "Identity verification",
    "request": {
      "method": "POST",
      "uri": "/1001"
    },
    "response": {
      "json": {
        "transNo": "${req.json.transNo}",
        "transDate": "${req.json.transDate}",
        "resultCode": "00000",
        "bizContent": {
          "insFlag": "Y"
        }
      },
    }
  }
]

这种用法较为常见,感谢!