I have a question for using Apach JMeter.
Our project, Android apps post json data with "Gzip Compression" to API server. The Android apps using "Apache HttpClient" and it's "GzipCompressingEntity" class.
For performance testing of API server, I tryed to recording the request by JMeter's Proxy (="HTTP(S) Test Script Recorder"). But the recorded request body was empty.
What I want to do is to send "Gziped HTTP request data" from Apache JMeter to server. Is there any way for that?
Following is sample of our Android app's request header.
POST /api/test HTTP/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Content-Encoding: gzip
Host: 192.168.11.11:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.5)
Accept-Encoding: gzip,deflate
RequestBody is Gziped binary data.
What I had done is
- Run the "HTTP(S) Test Script Recorder(Proxy Server)" on JMeter.
- Set http proxy of Android to use that proxy server.
- Execute Android test code of HTTP Client (the post data is compressed by Gzip).
then, that test code finished with failure. (no response from server)
If access directly (without JMeter's Proxy Server), that test succeeded. Can I send the compressed request data from JMeter just like this?
Add HTTP Header Manager to your test plan and add at least the following headers:
Add Beanshell PreProcessor as a child of the request which you need to encode and add the following code to it's "Script" area:
It will get your request body, compress it and substitute on the fly so the request will be gzipped.
Encoding is wrong, you need to save it in body like this