postman返回html页面是什么原因


    @RequestMapping("/Sku_Make_upTUUS")
    public String Sku_Make_upTUUS(@RequestParam(defaultValue = "1") Integer pageNo, Model model, String username, String skuf, String chanpinxian, Date indat, Date indatend, String dianpu) {
        Skumake(pageNo,model,username, skuf, chanpinxian, indat, indatend, dianpu);
        return "/Sku_Make_upTUUS";
    }

img


测试接口返回HTML页面这个是什么原因

你这需要 有返回体,在你的 方法上加个 @ResponseBody

  • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/7414360
  • 你也可以参考下这篇文章:Postman中用JS脚本来控制批量运行时接口的执行顺序
  • 除此之外, 这篇博客: postman高阶脚本中的 6、获取一个返回的HTML文件进行校验 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • var html, titleText;
    // load the response body as HTML using cheerio
    // and using cheerio's jQuery like .find API, get the H1 tag
    html = cheerio(responseBody);
    titleText = html.find('h1').text();
    // add a test that ensures that there is some H1 content
    tests["page must have h1 heading"] = Boolean(titleText);