How to get POST request body content in a variable

Katalon gives you a feature to verify your web request. I want to know if there is any other way to store httpbody in variable since getHttpBody() is deprecated after 5.5.
I tried other methods but that doesn’t seems to working.

please refer screenshot for more info.

below code is something you can try and check verification log that it prints a POST request body content.

import static org.assertj.core.api.Assertions.*
import com.kms.katalon.core.testobject.impl.HttpTextBodyContent
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.util.KeywordUtil as KeywordUtil
import com.kms.katalon.core.webservice.verification.WSResponseManager
import internal.GlobalVariable as GlobalVariable

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()
ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()

String b= request.httpBody.toString()

screen shot-

Hi @sachinsingh9960,
Please use getBodyContent().

hi @huynguyen
tried getBodyContent() but it does not work it seems please have a look in below screen shot, please correct me if I a doing something wrong. it works fine with httpbody and body gets printed in verification log

Hi @sachinsingh9960,
getBodyContent() will return an instance of HttpBodyContent, on which you should call writeTo(...) passing in an argument of typeOutputStream to get the content of the body. You can refer to our Java Docs at