Error: HC4CookieHandler unable to add the MalformedCookie

Solution to jmeter.protocol.http.control.HC4CookieHandler Unable to add the cookie MalformedCookie with Exception: Invalid expires attribute

A HTTP cookie (also called web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user's computer by the user's web browser while the user is browsing. Cookies were designed to be a reliable mechanism for websites to remember stateful information (such as items added in the shopping cart in an online store) or to record the user's browsing activity (including clicking particular buttons, logging in, or recording which pages were visited in the past). They can also be used to remember arbitrary pieces of information that the user previously entered into form fields such as names, addresses, passwords, and credit card numbers.

Add a HTTP Cookie Manager to your test plan at the Thread Group level as shown in the above screenshot. If you have a HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site.

Once you add the http cookie manager to the thread group, configure it as per your requirement. Implementation is set to HC4CookieHandler. The Cookie Policy normally sets to default.

In order to avoid this error set the Cookie Policy to standard and the HttpClient should be able to parse the required value.

Last updated