0

I want to send request payload as following in JMeter:

------WebKitFormBoundaryeBikRH0JCrgmtTvt
Content-Disposition: form-data; name="name"

test
------WebKitFormBoundaryeBikRH0JCrgmtTvt
Content-Disposition: form-data; name="description"

testing
------WebKitFormBoundaryeBikRH0JCrgmtTvt
Content-Disposition: form-data; name="configFile"; filename="my-project-1513669048551-73373e5a6b29.json"
Content-Type: application/json


------WebKitFormBoundaryeBikRH0JCrgmtTvt--

So I tried to add the name and description part in Parameters tab with form-data as Content-type and added file in Files Upload tab in HTTP Request Sampler.

This is what I am getting in Request Body after execution:

POST data:
--t9u984dDyYVtn6R0e8-OiZQyWRv9gk1
Content-Disposition: form-data; name="name"
Content-Type: form-data; charset=US-ASCII
Content-Transfer-Encoding: 8bit

test
--t9u984dDyYVtn6R0e8-OiZQyWRv9gk1
Content-Disposition: form-data; name="description"
Content-Type: form-data; charset=US-ASCII
Content-Transfer-Encoding: 8bit

testing
--t9u984dDyYVtn6R0e8-OiZQyWRv9gk1
Content-Disposition: form-data; name="configFile"; filename="my-project-1513669048551-73373e5a6b29.json"
Content-Type: application/json
Content-Transfer-Encoding: binary

<actual file content, not shown here>
--t9u984dDyYVtn6R0e8-OiZQyWRv9gk1--

I want to remove this part from the request for name and description part

Content-Type: form-data; charset=US-ASCII
Content-Transfer-Encoding: 8bit

This is resulting into failure with status code : 415 Need help on this please

1 Answers1

0

If standard multipart HTTP Request generated by JMeter's HTTP Request sampler when you tick Use multipart/form-data box doesn't work for you be aware that you can manually build the HTTP Request by using:

Check Testing REST API File Uploads in JMeter for more comprehensive explanation and detailed example

Dmitri T
  • 119,313
  • 3
  • 56
  • 104