转载自:https://blog.youkuaiyun.com/defonds/article/details/38495915
Badboy 录制好脚本以后,使用 JMeter 打开,直接运行测试,发现有个 Ajax 提交表单的时候出错了。服务器返回信息如下:
HTTP Status 415 -
type Status report
message
description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.
监听器 “察看结果树” 里发现该次请求:
Request Headers:
Content-Length: 7207
Connection: keep-alive
既然是Json 请求,这个 Content-Type 肯定有问题。所以为该次请求修改请求头里的 Content-Type 修正为 application/json;charset=UTF-8 之后,问题解决。

本文介绍了一种在使用JMeter进行性能测试时遇到的415错误的解决方案。当Badboy录制的脚本在JMeter中执行时,遇到了服务器拒绝请求的问题。通过对请求头中的Content-Type进行调整,从默认值更改为application/json;charset=UTF-8,成功解决了此问题。
4万+

被折叠的 条评论
为什么被折叠?



