Spirent Avalanche 5.46 February 29, 2024

HTTP Set Runtime Cookie Action

Use SETCOOKIE to allow runtime control of cookie values. This feature is especially useful for cookies that are created or stored by JavaScript.

To use this feature, you search for a value that is returned by a server response and then use SETCOOKIE to set the value. You can then use a GET or POST request to reply with the cookie value.

When you use this action, you assign the following variables:

Syntax

SETCOOKIE<name,value,date,path,domain,secure>

Additional information about the Internet Standards for Set-Cookie is included in RFC 2109.

Example

# request page which has cookie set via a JavaScript function.

1 GET http://192.168.42.11/talk/index.html

# assign using response data specified by the search criteria cookie_part

ASSIGN VARIABLE<Value cookie_part 1 >

# assign value from database cookie_name column 1

ASSIGN VARIABLE<Name cookie_name.$1>

# set the date

ASSIGN VARIABLE<Date "09 Feb 2010 21:18:00 GMT">

# set the path

ASSIGN VARIABLE<Path "/talk">

# set the domain

ASSIGN VARIABLE<Domain "192.168.42.11">

# set the secure flag

ASSIGN VARIABLE<Secure "false">

SETCOOKIE<name,value,date,path,domain,secure>

# connect to another page to verify the cookie is being sent with the request.

1 GET http://192.168.42.11/talk/musthavecookiepage.html


HTTP Assign Variables

Create New Cookie Jar Window

© 2024 Spirent Communications, Inc. All Rights Reserved.