Can someone help !!!
How to set String as setBodyContent(HttpBodyContent)
The below doesn’t seems to work
//for text in bodyimport
import com.kms.katalon.core.testobject.impl.HttpTextBodyContent
def json=’’’{
“data”: {
“id”: 2,
“email”: “janet.weaver@reqres.in”,
“first_name”: “Janet”,
“last_name”: “Weaver”,
“avatar”: “https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg”
}
}’’’
setBodyContent(new HttpTextBodyContent(json))
@duyluong
Hello, you miss import for HttpTextBodyContent class. Press Ctrl + Shift + O to fix.
Hi @Marek_Melocik
The import is available …
import com.kms.katalon.core.testobject.impl.HttpTextBodyContent
But still getting issue.
And do you get the same exception? Can you share full console log?
I noticed that you do not call setBodyContent method on any instance - you should call it on RequestObject instance.
That’s the issue, you are trying to set body content to no object. You should create RequestObject instance first and set body content to the instance.
I am not sure … can you help me on this.