Create a new Startupwithcookies.json, because the cookie is also requested in the band, so, to write in the request, the cookie is the form of k-v, take the landing to say it, the login will be the cookies, I will give key name called Login bar, value I called True
[ { "Description":"This is a request with cookies.", "Request":{ "URI":"/get/with/cookies", "Method":"Get", "Cookies":{ "Login":"true" } }, "Response":{ "text":"This is a GET request that needs to carry cookies to access" } }]
Then start the mock service:
Java-jar./moco-runner-0.12.0-standalone.jar http-p 8888-c Startupwithcookies.json
See the results of the visit in JMeter:
I added an HTTP cookie manager to the predecessor processor
Fill in the information that the cookie wants to bring, the value inside my JSON file is Login,value is true, I fill in.
Add an HTTP request, fill in the data, and then add a view result tree
Response data:
How to add cookies to the Mock4 Moco framework