moco响应结果浏览器访问乱码

moco响应结果浏览器访问中文乱码解决办法

 

 

浏览器访问中文乱码,可以在json文件中写明响应response的编码格式,在response中添加一下代码即可

"headers": {
"Content-Type": "text/html;charset=gbk"
}

[
  {
    "description": "模拟一个没有参数的get请求",
    "request": {
      "uri": "/getdemo",
      "method": "get"
    },
    "response": {
      "headers": {
        "Content-Type": "text/html;charset=gbk"
      },
      "text": "这是一个没有参数的get请求"
    }
  }
]

 

posted @ 2020-03-31 11:25  小白测试  阅读(445)  评论(0编辑  收藏  举报