如何解决POST呼叫可在Postman中使用,但JMeter会引发HTTP NoHttpResponseException错误
对于负载测试,我一直在准备不同的POST调用。首先是Postman(因为我发现它对用户更友好),一旦成功,我就在Jmeter中设置了实际的负载测试。在邮递员中,我始终获得所需的响应,但是在Jmeter中,出现以下错误:
org.apache.http.NoHttpResponseException: (servername here):443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:930) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1281) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1270) at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) at java.lang.Thread.run(Unknown Source)
到目前为止,我已经得出结论:
- Jmeter中的端点与Postman中的端点相同
- Jmeter中的身体与邮递员中的身体相同
- 我已将邮递员完全相同的标头复制到Jmeter
- 线程大小为1,所以我很难相信它与服务器有关。
有什么我想念的吗?我还能尝试什么?
解决方法
我可以想到两个可能的原因:
- “端点”并不完全相同,即协议/主机/端口不匹配,以确保JMeter配置与Postman 100%匹配,只是使用JMeter的{{3}记录源自Postman的请求},如果您HTTP(S) Test Script Recorder,JMeter将捕获请求并创建相关的configure Postman to use JMeter as the proxy采样器和HTTP Request(s)
- 您的计算机正在使用上游(公司)代理连接到Internet(或Intranet)。可能是Postman配置为遵守操作系统代理设置的情况,在JMeter中,您需要手动指定代理,有关更多详细信息,请参见HTTP Header Manager用户手册一章
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。