用于PUT的Jmeter 2.9 HTTP采样器未传递参数 [英] Jmeter 2.9 HTTP Sampler for PUT not passing parameters

查看:142
本文介绍了用于PUT的Jmeter 2.9 HTTP采样器未传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jmeter 2.9版,HTTP采样器来测试我的其余服务.

I'm using Jmeter version 2.9, HTTP sampler to test my rest services.

GET和POST可以正常工作,因为PUT没有将请求中的任何参数传递给服务器.

The GET and POST are working without any issues, where as PUT is not passing any parameters in the request to the server.

我用树中的查看结果对其进行了验证.

I verified it with view results in tree.

为什么会发生这种情况并解决此问题?

Any reasons on why this is happening and work around this issue?

推荐答案

它对我有用.根据我在互联网上阅读的内容,提出了不同的解决方案:

It worked for me. Based on what I read on internet, there were different solutions suggested:

  • 将内容编码更改为UTF-8
  • 在主体数据"标签中传递PUT参数(与在参数"标签中以表格格式传递参数相反)
  • 在HTTP标头管理器中将 Content-Type 标头设置为 application/json
  • 通过文件传递参数(即使这可以工作,如何传递动态值?)
  • 结合以上几点,
  • 将其作为 POST 传递.
  • Changing Content-Encoding to UTF-8
  • Pass the PUT parameters in the "body data" tab (as opposed to passing them in tabular format in the "Parameters" tab)
  • Setting Content-Type header to application/json in the HTTP Header Manager
  • Passing the parameters via a file (even if this were to work, how would you pass dynamic values?)
  • passing it as POST with a combination of above points.

对我有用的方法是这种组合:将内容类型设置为application/json + 在**主体数据中将参数作为"JSON"传递标签(下面是一个示例)

WHAT WORKED FOR ME is this combination: Set content type to application/json + Pass parameters as "JSON" in the **body data tab (below is an example)

我不需要指定UTF-8或其他任何内容.

I did not need to specify UTF-8 or anything else.

示例JSON参数主体: {"title":"JMeterTitle","preMortar":"JMeterPre","postMortar":"JMeterPost"}

这篇关于用于PUT的Jmeter 2.9 HTTP采样器未传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆