Documentation Index

Fetch the complete documentation index at: https://docs.catchpoint.com/llms.txt

Use this file to discover all available pages before exploring further.

Setting Cookies in API and Emulated Test

Prev Next

Cookies can be set by using the setHeader verb. In API and Emulated tests, this will only set cookies for the root request; redirects will not be passed with the cookie values. In such scenarios, an additional parameter needs to be passed.

Syntax for setting cookies for the root request

// for the root
open(www.google.com)
setHeader("Cookie", "key=value")

To set cookies for redirects, it is necessary to pass an additional parameter specifying the domain to which the cookies need to be appended. All subsequent requests/redirects from that domain will be set with the cookie value.

Syntax for setting cookies for redirects

// for redirect(s)
setHeader("Cookie:exampledomain.com", "key=value")