dreamhead / moco

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

返回response json时,template无法使用 #333

Open toyood opened 11 months ago

toyood commented 11 months ago

我做了如下尝试都不行。应该如何使用呢?我的场景是模拟服务接口,返回参数能够定制规则,比如支持表达式等,template也是一种方式,但是他不能使用。配置如下:

[
  {
    "description": "验证测试",
    "request": {
      "uri": "/login",
      "method": "post",
      "headers":{
          "content-type":"application/json;charset=utf-8" 
      },
      "json": {
          "username":"test",
          "password":"123456"
      }
    },
    "response": {
      "json":{
        "msg":"login success",
        "status":"200",
    "testDt":{"template":"${now(\"yyyy-MM-dd\")}}" //error
    "template":{"testDt":"${now(\"yyyy-MM-dd\")}}" //error
    "testDt":"${now(\"yyyy-MM-dd\")}"              //error
      }
    }
  }
]