Jmeter not POSTing binary data correctly - http

I am trying to post protobuf data with JMeter. I have a Sampler HTTP Request setup with the body as:
b''
This should simply be an empty protobuf object, but JMeter is actually sending some wrapped version of this:
b"b''"
I have used Content-Type to be both application/protobuf and application/octet-stream.
Is there a way to get JMeter to post EXACTLY what I give it.

Related

Is there a way to set the http Header values for an esp_https_ota call?

I'm trying to download a firmware.bin file that is produced in a private Github repository. I have the code that is finding the right asset url to download the file and per Github instructions the accept header needs to be set to accept: application/octet-stream in order to get the binary file. I'm only getting JSON in response. If I run the same request through postman I'm getting a binary file as the body. I've tried downloading it using HTTPClient and I get the same JSON request. It seems the headers aren't being set as requested to tell Github to send the binary content as I'm just getting JSON. As for the ArduinoOTA abstraction, I can't see how to even try to set headers and in digging into the esp_https_ota functions and http_client functions there doesn't appear to be a way to set headers for any of these higher level abstractions because the http_config object has no place for headers as far as I can tell. I might file a feature request to allow for this, but am new to this programming area and want to check to see if I'm missing something first.
Code returns JSON, not binary. URL is github rest api url to the asset (works in postman)
HTTPClient http2;
http2.setAuthorization(githubname,githubpass);
http2.addHeader("Authorization","token MYTOKEN");
http2.addHeader("accept","application/octet-stream");
http2.begin( firmwareURL, GHAPI_CERT); //Specify the URL and certificate
With the ESP IDF HTTP client you can add headers to an initialized HTTP client using function esp_http_client_set_header().
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_http_client_set_header(client, "HeaderKey", "HeaderValue");
err = esp_http_client_perform(client);
If using the HTTPS OTA API, you can register for a callback which gives you a handle to the underlying HTTP client. You can then do the exact same as in above example.

How to document response json object in PAW

I'm using PAW for testing and documentation writing, everything is okay, PAW works like its needed but when I send the request and got the JSON object response, how to document it (for example if I export to swagger, this is the responses/schema/properties/description part). I can write documentation/comment for request, variables, etc but not for response which is highly needed.
Thanks (PAW 3.1.10)

Post request handling with lua script in nginx

I use lua script to generate data from the parameters and bodies, and then send the data to the other server.
When i handle a GET request, nginx returns a normal response.
However, a 404 not found error occurs when handling POST requests.
However, internal operations were normal and sent the data to the other server.
Only the request method has changed.
If i explicitly pass the value to ngx.say or ngx.exit, i get 200 response normally.
Why? Is it necessary to explicitly return a response code when using a post request with a lua script?
In addition, I am using empty_gif.
I have searched for the above problem.
empty_gif can only be used to respond to GET and HEAD request methods
so I will use 204 response code

JMeter http request DELETE with body

I have proprietary http based API to test from JMeter. Unfortunately some of the endpoints of the API are expecting http DELETE method with a request body (I know its questionable API design to use DELETE with request body, but I have no ability to change that API and need to test it).
How can I test it from JMeter? It seems that standard HttpRequest sampler silently ignores my body payload without any warnings. (When I try it in POSTMAN its sending a request body for DELETE method)
I did find an old JMeter plugin called HTTP Raw Request that somewhat helps but still doesn't auto-calculate "Content-Length:" http header for my body payload...so I have to do it manually for every test case - which is a pain for dynamically generated data payloads.
So my question still remains: How can I test HTTP DELETE with request body from JMeter?
Here is the screenshot:
NOTE1: Starting from jMeter ver. 3.1 (see bugzilla #60358) it was fixed for Http GET request to be able to send body in the request...but DELETE was not added.
NOTE2: See bugzilla #61443 for the DELETE request with body.
NOTE3: I'm using client implementation called "Java".
As per reference docs:
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request
There are 2 implementations for http request sampler. The non default one called "Java" has this issue with not passing DELETE request body.
Luckily the default implementation called "HttpClient4" that correctly passes request payload for DELETE operation as per JMeter data entry screen.
To change implementations for http request sampler you have to go to "advanced" tab of the HTTP Request Sampler and select client implementation "HttpClient4" instead of "Java". Here is the screenshot:
After that when executed it correctly sends request payload for DELETE operation. Here is the screenshot:

Apache JMeter 3.0 Multipart Request works for POST but not for PUT

When I make a multipart request using the POST method to my server, the request works fine.
Below is how I've set up my JMeter:
POST REQUEST
However, when I try to make a PUT request to the same URL, the request does not work.
PUT REQUEST
And the error on the server is
org.springframework.web.multipart.MultipartException: Current request is not a multipart request
This seems to be an issue on the JMeter, since that when I try to do the same request using Postman, the request using POST or PUT works correctly.
However, I want to use JMeter to test my application performance.
The question is: How to make PUT multipart request using JMeter?
As of JMeter 3.0 multipart/form is only available for POST method, while it appears to be possible for other http methods.
So it's a bug:
https://bz.apache.org/bugzilla/show_bug.cgi?id=60015
See also:
http://mail-archives.apache.org/mod_mbox/jmeter-dev/201609.mbox/%3cCAH9fUpbN5jVSNmJUWTFOQUoRM64LNdKY=j8ZjGWzRt6gDuNzdg#mail.gmail.com%3e
It should be fixed in next releases.

Resources