Various request formats in JMeter--aduocd's blog

Background: 1. In JMeter's HTTP request testing, different request formats are often used. Common formats such as json, form-data, x-www-form-urlencoded, multipart/form-data. There has been a previous article about the request being json. This time I write other formats, and I will also introduce how to operate in JMeter when there are multiple HTTP requests with different request formats.

2. Due to project reasons, the first request to log in to the interface uses x-www-form-urlencoded format; the second request uses json format; the third request uses multipart/form-data.

Here is a separate introduction to how the HTTP requests of these three request formats are implemented.

Step 1: x-www-form-urlencoded format. Add the HTTP header manager and fill in the format of the sent request, as shown in the following figure.

 

Then add the HTTP request and fill in the correct input values:

 

 

 

Step 2: Multipart/form-data format. Like other HTTP requests, you need to fill in the corresponding input parameters. For input parameters in the format of attachments, you need to upload them in "Send file with request", and then assign a variable name, and you need to check "Use multipart/form-data for POST"

 

 

 

Others: There must be some friends here who will ask, what should be done when there are multiple formats of requests in this interface. Only one "HTTP header manager" can be added. In fact, the logic controller in JMeter can be used here to divide the request. For example, by adding a transaction controller, you can separate requests, just like packaging. In this way, each request will have a corresponding HTTP request format. Look carefully at the request in step 1. This is how it is done~~~

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325642469&siteId=291194637