Forum Discussion

Taz's avatar
Taz
Contributor
2 years ago

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? 

  • 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.

     

     

  • Taz's avatar
    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.

     

     

  • KarelHusa's avatar
    KarelHusa
    Champion Level 1

    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.

     

    • Taz's avatar
      Taz
      Contributor

      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's avatar
        KarelHusa
        Champion Level 1

        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.