DataScript: avi.http.get.response.body

Function avi.http.get_response_body(size [,offset])
Description Reads a specified number of kilobytes — not to exceed 32,768 kB (32 MB) — from the buffered body starting at the specified kilobyte offset. If the offset is not specified, reads from the beginning of the buffer. The buffered body will only be processed once by the LUA script.
Events HTTP_RESP_DATA
Parameter size is the number of kilobytes to be read. If specified, the minimum value is 1.

The optional offset parameter determines the kilobyte offset at which the first byte is to be read. If specified, the minimum is 1. If not specified, 0 is assumed, i.e., bytes are read from the beginning of the buffer.

Returns If data exists, returns the data stored in the variable. Else returns nil.
Related avi.http.set_response_body_buffer_size() sets the maximum response body to be buffered.
Example Response Data Event Script:

local body = avi.http.get_response_body(50)
if (body ~= nil) then
    local uuid = string.match(body, "uuid:(%w+)")
    if (uuid ~= nil) then
        local srv = avi.pool.server_ip()
        avi.vs.table_insert(uuid, srv)
    end
end
Request Event Script:

uuid = avi.http.get_cookie("uuid") 
if ( uuid ~= nil) then 
    local srvr = avi.vs.table_lookup(uuid) 
    if (srvr ~= nil) then 
        avi.pool.select("pool-3", srvr) 
    end 
end