Available in all subroutines.

Appends an HTTP header to a request or response object.

add resp.http.Set-Cookie = "myCookie=foo; path=/; SameSite=Strict; Secure; max-age=60";

If the header already exists, another with the same name is appended to the same request, and the existing header remains in place. The add statement is commonly used to add Set-Cookie headers, where it is important not to override any other Set-Cookie headers that might already be in the response.

If you prefer to replace any existing header value, use set instead.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.