# How to check if request body is set?

**URL:** <https://community.postman.com/t/how-to-check-if-request-body-is-set/34428>\
**Category:** Help Hub\
**Created:** [April 12, 2022, 10:39am UTC](https://community.postman.com/t/how-to-check-if-request-body-is-set/34428 "2022-04-12T10:39:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenpeng](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@svenpeng](https://community.postman.com/u/svenpeng)\
**Post date:** [April 12, 2022, 10:39am UTC](https://community.postman.com/t/how-to-check-if-request-body-is-set/34428/1 "2022-04-12T10:39:09Z")

</div>

_My question_: How can I check in a pre-request script if the request body has any content?

_I’ve already tried_:

```auto
if (!pm.request.body.isEmpty) {

```

```auto
if (!pm.request.body.disabled) {

```

… but it doesnt work for me. The if-statement is always true. ☹

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [April 12, 2022, 11:33am UTC](https://community.postman.com/t/how-to-check-if-request-body-is-set/34428/2 "2022-04-12T11:33:43Z")

</div>

Hi @svenpeng

Try;

```auto
if (!pm.request.body.raw){
    console.log('NULL');
    console.log(pm.request.body);
}else{
    console.log('NOT NULL');
    console.log(pm.request.body);
}

```

Example output;  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/4/43e7d079445aa67fb4a16ffafacf583434f02f58.png)
