PingAccess

Body object reference

This object accesses the Body object in Groovy exc?.request?.body or exc?.response?.body.

Purpose

The Body object contains the HTTP body from the application request or the HTTP body from the site response. The request HTTP body is sent on to the site after the rules are evaluated. The response HTTP body is sent on to the User-Agent after the response rules are evaluated.

Groovy sample

//Checks the actual length of the body content and set the Content-Length response header
def body = exc?.response?.body;
def header = exc?.response?.header;
header?.setContentLength(body?.getLength());
pass();

Method summary

Method Description

byte[] getContent()

Returns the body content of the request or response.

int getLength()

Returns the length of the body content.