DataScript: avi.http.get_reqvar
DataScript
Function | avi.http.get_reqvar() |
Description | Gets (reads) data stored in a variable via the avi.http.set_reqvar() function. These variables have scope across the HTTP_REQ and HTTP_RESP events. Typically this function is used when data must be stored (set) in the HTTP request event, and retrieved (get) during the HTTP response event. The lifetime of data stored in the reqvar functions are limited to the HTTP request/response transaction. After the response completes, the variable is automatically unset. Any Lua value can be stored within this variable.
This variable type may be used by other components within Avi Vantage, not just DataScripts.
Avi supports three levels of storing data in variables.
|
Events | HTTP_REQ HTTP_RESP |
Parameter | Name: Specify the name of the variable to be declared. The name is a string and must be in quotation marks. |
Returns | If data exists, returns the data stored in the variable. Else returns nil. |
Version | 17.1+ |
Related | avi.http.set_reqvar() Retrieves the stored variable from the avi.http.set_reqvar function |
Example | HTTP_REQ event:
avi.http.set_reqvar("foo", 10)HTTP_RESP event: if avi.http.get_reqvar("foo") > 5 then avi.vs.log("Foo=" .. avi.http.get_reqvar("foo")) end |
Note: This API is not supported in the events SSL_PRECONNECT
, SSL_CLIENTHELLO
, and SSL_HANDSHAKE_DONE
.