Ask a Question

How to change Content-Length?

SOLVED
Taz
Contributor

How to change Content-Length?

ReadyAPI seems to calculate the Content-Length but doesn´t account for special symbols like Umlaute (ä,ö,ü) which adds additional bytes to the content-length.  I added a "content-length" manually to the headers but it does not overwrite the calculated content-length, at send it´s still using the calculated one?  Is there any setting how this could be accomplished? 

7 REPLIES 7
KarelHusa
Champion Level 3

@Taz, ReadyAPI is responsible for calculating the content-length as it builds the request. That's why it overrrides your value. There might be a hack to force your value, but I would not recommend doing that. 

 

Please note transport compression also matters.

 

I would be very surprised if ReadyAPI does not include national characters since a lot of communication would not work. Anyway, if you still think there's an issue you can contact support.

 

Karel@apimate.eu
https://apimate.eu

It definitely appears to be a bug and in the process of debugging this issue we discovered more problems.  Other Header Values appear to be ignored, too, even though they appear correct in ReadyAPI.  Even though we use utf-8 umlaute appear as ?.  The same call made from Postman with the exact same content and header works correctly.  When we tried to check the traffic via Fiddler, to see what exactly is being passed from one to the other, we were not able, nothing appears in Fiddler, even though when making the same call from Postman it appears correctly in Fiddler. 

KarelHusa
Champion Level 3

@Taz,

I encountered similar issues with ReadyAPI and SoapUI when I had special characters or encoding mismatches in my request data. Especially when the request data are exchanged via MS Teams or similar tools, unexpected characters may be inserted.

 

Postman cleaned the data and sent it modified, so no issue appeared, whereas ReadyAPI tried to use exactly what I inserted and ended up in error.

 

I would recommend double-checking your request data (encoding, invisible special chars, etc.) Once I removed the special chars, ReadyAPI worked fine. 

 

Karel@apimate.eu
https://apimate.eu

Thanks.  Unfortunately it seems the problem is maybe lying somewhere else.  I figured out why it isn't working.  We are putting text into the body using utf-8.  This works fine when there's no special character in it like Umlaute.  I tried now to convert the text first to ANSI and pasted it then into the body.  Now it works correctly.  Yet this is bad, because in our tests we're picking up content from another request and putting the response straight into this request.  It means now we first have to convert it to ANSI Format.

KarelHusa
Champion Level 3

@Taz,

if there's a correct UTF in the beginning, you should be able to paste it into ReadyAPI with no issues. ReadyAPI is fine with UTF8 and national characters, we also use them. Check also the encoding headers in your HTTP request.

 

I recommend verifying whether the source data are correct. Converting data to ASCII is an unwanted modification of the test data, they need to be the same as in reality.

 

Karel@apimate.eu
https://apimate.eu
Taz
Contributor

Contacting support we figured out how to resolve this problem.  It appears that UTF-8 doesn't seem to be the default and modifications need to be made in the configuration file. In our case we're using Windows and needed to edit the configuration file ReadyAPI.vmoptions.  In it it's necessary to add the following Entry:

 

-Dfile.encoding=UTF8

 

More information can be obtained by looking into this documentation:

 

https://support.smartbear.com/readyapi/docs/testing/best-practices/unicode-support.html

 

Personally I still think it's a bug because in my opinion UTF-8 should be the default.

 

 

After contacting support we found the solution.  See my latest post. 

cancel
Showing results for 
Search instead for 
Did you mean: