简体   繁体   中英

Jmeter 2.9 HTTP Sampler for PUT not passing parameters

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

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:

  • 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.

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)

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

EXAMPLE JSON PARAMETER BODY: {"title":"JMeterTitle","preMortar":"JMeterPre","postMortar":"JMeterPost"}

Pass parameters in path field using:

?name=value&name2=value2

and body in Raw Post body. if it doesn't work report a bug .

Example:

在此输入图像描述

First, try see the logs.

Had a similar problem. I was using wrongly the "Content-enconding" field as it were the HTTP Content-Type param. They are not related.

If you need to set Content-Type=application/json you have to use a "HTTP Header Manager" config element.

After setting correctly Content-enconding to UTF-8 the put request started to work.

JMeter的

You should add a parameter with an empty name (in the "parameters" tab).

If the problem persists use the result tree view to analyze the request settings.

I'm using JMeter 2.13 and facing with similar problem. This is How I've solved it:

  • Setting Content-Type header to text/plain in the HTTP Header Manager
  • Changing Content-Encoding to UTF-8
  • In the parameters tab, add the params without name and separated with ampersand character ( & )

Screenshot JMeter PUT request example

Hope it helps!

I am using JMeter 2.11 and I had the same problem. I solved in this way:

1) Setting Content-Type header similar to that you are using in your api method(Example: application/json or application/x-www-form-urlencoded etc.) in the HTTP Header Manager.

2)In HTTP Request. Body Data should look like this:

KEY=VALUE&KEY=VLAUE&KEY=VLAUE&KEY=VLAUE.......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM