@capacitor-community/http : Android GET request surfaces EOF Exception

In an effort to circumvent CORS issues, I’m using the native @capacitor/http plugin to access our various web services. It works fine on iOS Simulator, but not on Android Simulator. I’ve discovered that one REST endpoint implemented in PHP returns JSON which is successfully received and parsed; however when I invoke another GET request implemented by our server (c++), the Plugin surfaces an EOF exception. This endpoint is well tested and know to operate correctly.

The code in the Plugin throwing the exception is in HTTPRequestHandler::readStreamAsString method. The specific line is “String line = reader.readLine();”. I observed that the readLine does successfully fill the buffer with the entire server response prior to throwing the exception. My initial suspicion was that readLine surfaces EOF exception in the absence of and EOL character but then realized that the PHP endpoint doesn’t include an EOL character(s) and that works. I also noticed that first one written in PHP uses chunk for transport encoding, whereas the second problematic endpoint responds with content-length.

I find it difficult to believe the error is in this popular plugin but I’m at a loss given what I’ve observed.

Any insights, and/or suggestions welcomed.

The EOF issue is a product of GZIP REST responses which are typically only sent for larger payloads. That may explain why others are not experiencing this issue.