Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(WebViewLocalServer.java): return 404 error code when a local fil…
…e is not found (#217) Currently, the Android version of the plugin always returns http code 200 no matter if the resource you're trying to get exists or not. The iOS version does. This makes the two implementations inconsistent. This tries to fix that and use the same expected behavior in both of them. BREAKING CHANGE: Until now, the Android part of the plugin was returning a 200 http code even though the requested file didn't exist. This behavior was inconsistent with the historical behavior of the iOS webView. This change makes them both work in the same manner but introduces a breaking change for the current Android users that are expecting a 200 http code no matter what and are testing the not found error just by checking if the body is null. fix #216
- Loading branch information
f7a551e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
This check causes our application to stop working, due to the InputStream.available() method returning 0 in our case, even though the local file exists and there are bytes to be read. Per the Java documentation for InputStream.available(), the result is only an estimate of how many bytes can be read without blocking, not an exact amount:
(https://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#available(), note that the default implementation of available() in InputStream also returns 0)
Is it possible to implement this functionality without using available()?