3

I have working http request call with JSON body. WHat I want to do is to use the same content as an external file. For this I have used "send files with the request" function, without using multi-part because our server doesn't support that. I tried with or without parameter name or MIME type and the result is the same 400. The same call is working if instead I use the JSON in the body. File location is good, i double checked that. THe actual content of the file is not displayed in the request.

Any ideas?

1
  • If answer is OK, you should accept it so that it's helpful to others Commented Aug 26, 2013 at 9:06

2 Answers 2

1

As per documentation:

Name of the file to send. If left blank, JMeter does not send a file, if filled in, JMeter automatically sends the request as a multipart form request. 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. See below for some further information on parameter handling.

Sign up to request clarification or add additional context in comments.

6 Comments

How about writing an example ? I' m trying { post: {title:"Hello", file: ${filepath}, visible:false } } , where filepath is my parameter name, and that text i place on the value field of an empty name parameter
Show your sampler configuration. If you want examples, download JMETER 2.10 RC2 (see t.co/E3NE3rWGmu), use new Template feature it will show you how to do.
Which template has the File post with json example ?
Meanwhile I've added a proxy under jmeter and notice the request seems to go only with file content
do you mean you have an attachment ?
|
0

You can use the Jmeter function __fileToString for that: https://jmeter.apache.org/usermanual/functions.html#__FileToString

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.