Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(WebViewLocalServer.java): return 404 error code when a local file is not found #217

Merged

Conversation

robertohuertasm
Copy link
Contributor

@robertohuertasm robertohuertasm commented Nov 14, 2018

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 return a specific http code for every case. This makes the two implementations inconsistent. This tries to fix that and get the same expected behavior in both of them.

Note that I've used a 500 code in case the call to the available method fails. If this is not right let me know and I'll change it. 😉

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

…e is not found

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 ionic-team#216
@mlynch
Copy link
Contributor

mlynch commented Nov 21, 2018

Thanks for the PR. Any implications of this that we should be aware of? Are you using Ionic 4 with HTML5 routing by chance?

@robertohuertasm
Copy link
Contributor Author

robertohuertasm commented Nov 21, 2018

You're welcome! Regarding the implications, none that I'm aware of apart from the breaking change I described above. Unfortunately, I'm not using Ionic 4 so I haven't been able to check if there were some unexpected side-effects. The way I see it is that the iOS version is already working like that, so my guess is that we may not expect any further implications.

@jcesarmobile
Copy link
Member

Thanks for the PR.
As the change might be breaking, we will include it in next major release

@robertohuertasm
Copy link
Contributor Author

You're very welcome! Do you have any idea of what will be the estimated release date?

@jcesarmobile
Copy link
Member

There is no release date, but shouldn't take long.

@jcesarmobile jcesarmobile merged commit f7a551e into ionic-team:master Dec 12, 2018
@robertohuertasm robertohuertasm deleted the return-404-if-no-file branch December 12, 2018 12:33
Ionitron added a commit that referenced this pull request Jan 3, 2019
# [3.0.0](v2.3.1...v3.0.0) (2019-01-03)

### Bug Fixes

* **iOS:** Remove unused code ([#247](#247)) ([bceb17a](bceb17a))

### Features

* Allows configuration of Mixed Content Mode ([#240](#240)) ([486d412](486d412)), closes [#231](#231)
* **Android:** Implement ionic-file and ionic-content urls ([#242](#242)) ([8ef0c30](8ef0c30)), closes [#204](#204) [#183](#183)
* **iOS:** Remove GCDWebServer ([#244](#244)) ([0dee0cf](0dee0cf))
* **WebViewLocalServer.java:** return 404 error code when a local file is not found ([#217](#217)) ([f7a551e](f7a551e)), closes [#216](#216)

### BREAKING CHANGES

* **iOS:** Sets deployment-target to 11, so will only work on iOS 11+

* Address changes
* changes the default from 1 (never) to 0 (always)
* **WebViewLocalServer.java:** 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.
@Ionitron
Copy link
Collaborator

Ionitron commented Jan 3, 2019

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent behavior between Android and iOS version
4 participants