Grant H.
Grant H.

Reputation: 3717

JMeter not attaching contents of binary file to POST data in HTTP Request

I'm attempting to simulate a login call with JMeter 2.11 to a service that uses a binary format. I've created an Http Request with the appropriate settings, except for the body data. I need to POST raw binary data.

According to the docs here, I should be able to set the file path for exactly one file, with no parameter name, and no other content in the Body Data, and have it place the data in the request body.

If it is a POST or PUT or PATCH request and there is a single file whose 'Parameter name' attribute (below) is omitted, then the file is sent as the entire body of the request, i.e. no wrappers are added. This allows arbitrary bodies to be sent. This functionality is present for POST requests after version 2.2, and also for PUT requests after version 2.3.

However, when I run the test, the POST Data is empty.

I have tried the extra set of plugins for JMeter as well, but alas, I'm stuck. The loaded file has 145 bytes of data, and the request shows that the content-length is 0. What am I missing?

The Http Request enter image description here

The result

enter image description here

Update 1

To clarify, I am NOT attempting to send a file, I'm attempting to send a binary encoded message as raw POST data.

Upvotes: 0

Views: 8602

Answers (2)

zackzack
zackzack

Reputation: 11

  • This is my solution,maybe not best, but it works fine:

1st step :

  • You should write your binary data to a file (assume it's name is FILENAME);

2nd step :

  • For your http request sampler,Yout should put ${FILENAME} under file path in the "Send Files with the request" section (while leaving its paramter name empty and specifying an encoding (for binary, it is application/binary)).

Hope it helps. Refer to this article

Upvotes: 1

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34516

Switch back to Parameters tab not Post body.

See:

Yoy could try recoring to see how the resuest look like.

Upvotes: 2

Related Questions