Get JSON request body

I want to know if there is any other way to store httpbody in variable since getHttpBody() is deprecated after 5.5. in my case, i want to get the request body in json string for later use in authentication things, any suggest ? cant find the related one at latest api doc, thanks before

What do you mean by this?
Please point me to the URL where you read it.

image

short story is, i want to get the API request body as json string and store it in some variable before hitting the API request, now i can use getHttpBody() which is return json request body as string, but the IDE says its deprecated, is there any new solution related for my case ? thanks

API doc is here:
https://docs.katalon.com/javadoc/com/kms/katalon/core/testobject/RequestObject.html#getHttpBody()

Hmmm seems like not related with my case, i just want to get the request body not setting the body content, anyway thanks with the answer, i think i will stick with the Deprecated method one

I think you were confused by a mistake in the doc:

Please use setBodyContent(HttpBodyContent) instead.

This sentence must be a mistake.

You would want to look at RequestObject::getBodyContent

@ThanhTo
I think that the API doc requires a correction.

LOL you’re right, thanks for the solution, now it works like a charm, just had to put it at HttpTextBodyContent since it implemented Interfaces and Traits of HttpBodyContent


The solution become like this, in case someone had the same problem with me, this is my solution

anyway thanks again for the help @kazurayam :grin: