To send a request with a Cookie, you need to add the "Cookie: name=value" header to your request. To send multiple cookies in a single Cookie header, separate them with semicolons or add multiple "Cookie: name=value" request headers. In this Cookies Request Example, we send Cookies in the request header to the ReqBin echo URL. Click Send to execute Cookies Request Example online and see the results. The Java code was automatically generated for the Request Cookies example.
HTTP (Hypertext Transfer Protocol) is an application layer data transfer protocol. HTTP is used to transfer data between HTTP clients (browsers and mobile apps) and servers. HTTP is built on a request-response architecture between a client and a server. The client send a request to the server, then the server processes that request and send a response back to the client.
HTTP Сookies is data sent from a website and stored by a web browser on a user's computer. Cookies are placed on the device (computer, mobile phone) used to access the website. These cookies are marked with an identifier that is unique to you and your computer. Cookies manage user sessions, track users and personalize (store site settings and user preferences). Browsers usually send cookies back to the server with each subsequent request, which allows the server to determine if the request came from the same browser or not.
What are Cookies used for?
Websites use HTTP cookies to improve the user experience when visiting the website. Cookies allow websites to remember you and do not require you to log in every time you visit a website. Cookies can keep the items in your cart and restore them when you visit the online store the next day. Cookies are stored locally on your device. If you delete cookies in your browser or visit the website in incognito mode, the website will not remember you, and you will become a new user who came to the website like the first time.
Cookies are used to:
Session Management: Cookies allow websites to recognize users and remember their login information and settings.
How can I see saved cookies in my browser?
To view stored cookies in your browser:
Press F12 to open the developer tool;
Click on the Application tab;
Under the "Storage" section open Cookies node and click on your website address;
Here you will see all the cookies stored in your browser for this site.
How to send a Cookie request?
An example of sending Cookies request to the ReqBin echo URL:
Send Cookies Example
GET /echo/get/json HTTP/1.1
Cookie: name=value; name2=value2