running a webap[i test, unable to chane content type to application/json

I am testing my first api, In the http headers section I have content-type set tp application/json


In the Test listener script, I also have

Yet every time I run it I get the following error

1 Like

In

,
you wanted to manipulate an instance of RequestObject which a HTTP client (Katalon Studio) is to send to a HTTP server.

In

,
you looked at an instance of ResponseObject which a HTTP server sent back to Katalon Studio as an HTTP client.

The RequestObject and ResponseObject — these 2 objects are different entities.

Do you expect that you can force the “Content-Type” of a HTTP response to be the same as the “Content-Type” of the respective HTTP request ?

You are expecting something very odd.

I am afraid that you are tired. Have a good rest and come back later.


This picture tells me that the HTTP server responded a HTML with a error message “Length Required”. This means, your test code is wrong somehow. You should fix your mistake first. The Content-Type Header is not really an issue to be addressed.

Please find the request.setHttpBodyType is underlined, which indicates a mistake.

Here is the javadoc of RequestObject:

It has no setHttpBodyType method implemented. Here is a mistake of yours. There could be more.

1 Like