How to add cookies to the Mock4 Moco framework

Source: Internet
Author: User
Tags http cookie

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.