---
title: Body object reference
description: This object accesses the Body object in Groovy exc?.request?.body or exc?.response?.body.
component: pingaccess
version: 9.0
page_id: pingaccess:reference_guides:pa_body_object_ref
canonical_url: https://docs.pingidentity.com/pingaccess/9.0/reference_guides/pa_body_object_ref.html
revdate: February 6, 2023
section_ids:
  purpose: Purpose
  groovy-sample: Groovy sample
  method-summary: Method summary
---

# 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.              |
