Reputation: 43
I'm trying to send a GET request that has bracket characters ('[]', '{}') in the query parameters which makes JMeter (v5.6.3) think I am trying to use globbing. I have been testing my API using Postman which showed me that I could turn of globbing with -g or --globoff. However, JMeter does not support this option as I found out here: https://jmeter.apache.org/usermanual/curl.html
The brackets are there because I am trying to send JSON objects in the query parameters. I unfortunately cannot change the API's method and put the JSON in the body. It HAS to be in the query parameters.
Is there a work around for unsupported options or a better way to send JSON objects in the query parameters?
Upvotes: 0
Views: 32
Reputation: 2847
Certain characters in URL need to be percent-encoded, in JMeter there is __urlencode() function which can do percent-encoding for you.
Also given you're capable of running your request in Postman you should be able to record it using JMeter's HTTP(S) Test Script Recorder
Run your request in Postman -> JMeter will capture the request and generate appropriate HTTP Request sampler configuration
More information: How to Convert Your Postman API Tests to JMeter for Scaling
Upvotes: 1
Reputation: 43
As Postman is preparing your request it url-encodes the query parameters but leaves brackets out if you are not using globbing. However, you do not need to turn globbing off in JMeter to have JSON in the query parameters. You can encode the brackets too like so:
You can do it by hand or find a url encoder online. If you choose the latter, do not give the encoder Postman's partially encoded request as it has already been encoded once and will try to encode the existing '%' characters.
Note: I solved the problem as I was writing it but wanted to keep the question up because I want to learn more alternatives as I am pretty new to all this. *
Note 2: 'encode' word count: 8
Upvotes: 0