Setting HTTP Header in Katalon

Hi all,

I have to set the HTTP header like this image below, since client_id, session_id and client_version is not provided by Katalon, how i set this value in Katalon?

Your help would be very appreciated :slight_smile:

Thankyou

3-12-2018 2-33-05 PM.png

Windiany,

Our list is just the suggestion and common items. You are free to type new item there and input value.

Trong Bui said:

Windiany,

Our list is just the suggestion and common items. You are free to type new item there and input value.

Hi @Trong Bui I already try to type those items in HTTP header in Katalon, but the output always 503. But when I tried using Postman, the response code is 200.
please kindly suggest me

It is a bit hard to debug in your case since we could not access the real url. Could you take screenshot of the case in both Katalon Studio and Postman? We are trying to see what exactly is the problem.

Hi @Trong Bui

Here is I attached the screenshoot for my case in Katalon and Postman. I already set the same HTTP Header. It works in Postman, but doesnt work in Katalon.

Please kindly suggest me, thankyou

test123.png

Windiany,

Sorry that I still could not find out what happened. Do you have anything in the Body tag of Postman’s screenshot?

Windiany,
is there any value in http body? if no, as I see in your screenshot all the params is in http header. so, u can use below sample code in script mode :

RequestObject requestObj = new RequestObject()
List headerParameters = new ArrayList()

//adding the header params
headerParameters.add(new TestObjectProperty(‘Content-Type’,
ConditionType.EQUALS, ‘application/vnd.api+json’))
headerParameters.add(new TestObjectProperty(‘session_id’, ConditionType.EQUALS, ‘xxxxx’))

requestObj.setHttpHeaderProperties(headerParameters)
requestObj.setRestUrl(“url”)
requestObj.setRestRequestMethod(“POST”)

WS.sendRequest(requestObj)

etc…

hope its helpful

Please verify with parameters initialization if necessary…

Header and Path parameters.jpg