URLLoader.data is cut on HTML5

I load some data from my server with URLLoader and it works fine on every platform except HTML5.
When I check data with Firefox Developers tools, I see that data was received in full, at the same time URLLoader.data contains only part of the data.
Any idea why it can happen?
Thank you!

Perhaps you can edit “lime/_backend/html5/HTML5HTTPRequest.hx” and add some trace messages. You may be able to see what comes in either for a data HTTPRequest:

or for a String HTTPRequest:

This powers the URLLoader class in OpenFL :slight_smile:

Ok, so the problem is converting bytes to string.
When I do this, it cuts the data.

How can I convert Bytes to UTF8 string correctly?

Is it here in HTTPRequest, or in your own code?

You could change the contentType field of your URLLoader to have it be a string request type. Another option is to use byteArray.readUTFBytes (byteArray.length) if my memory serves me correctly

It’s in my code, Bytes has correct length, but when I covert it to string, it cuts.
There is no contentType, but dataFormat.
So, changing it to URLLoaderDataFormat.TEXT seems fixing the problem.
Thank you!

1 Like