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请求"
    }
  }
]

原文地址:https://www.cnblogs.com/linxinmeng/p/12603920.html