-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Http error callback #885
Http error callback #885
Conversation
e184e51
to
0480efe
Compare
What is the difference between that and onLoadingError ? |
@Titozzz I assume you are talking about the |
# [7.1.0](v7.0.7...v7.1.0) (2019-09-21) ### Bug Fixes * **iOS:** Call dispatchViewManagerCommand with correct number of arguments ([#886](#886)) ([33f1ee3](33f1ee3)) * **iOS:** inconsistent backgroundColor ([#868](#868)) ([d25b20a](d25b20a)) ### Features * **iOS:** Allow custom CA to be used on webview requests ([#865](#865)) ([136fbd8](136fbd8)) * **new prop:** onHttpError callback ([#885](#885)) ([552472c](552472c))
🎉 This PR is included in version 7.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* master: (182 commits) chore(release): 7.2.5 [skip ci] fix(types): Make onContentProcessDidTerminate optional (react-native-webview#890) chore(release): 7.2.4 [skip ci] fix(android): Revert scroll update from react-native-webview#281 (react-native-webview#889) chore(release): 7.2.3 [skip ci] fix(iOS): Xcode issues and warnings (no functionality changes) (react-native-webview#860) chore(release): 7.2.2 [skip ci] fix(android): redirect and renderLoading issues (react-native-webview#548) chore(release): 7.2.1 [skip ci] fix(android): Filter extra onLoadProgress & add url event (react-native-webview#643) chore(release): 7.2.0 [skip ci] feat(iOS): Add callback for webViewWebContentProcessDidTerminate (react-native-webview#774) chore(release): 7.1.1 [skip ci] fix(Android): hardware acceleration issue (react-native-webview#854) chore(release): 7.1.0 [skip ci] feat(iOS): Allow custom CA to be used on webview requests (react-native-webview#865) feat(new prop): onHttpError callback (react-native-webview#885) fix(iOS): Call dispatchViewManagerCommand with correct number of arguments (react-native-webview#886) fix(iOS): inconsistent backgroundColor (react-native-webview#868) chore(release): 7.0.7 [skip ci] ... # Conflicts: # android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java # ios/RNCUIWebView.h # ios/RNCUIWebView.m # ios/RNCUIWebViewManager.m # ios/RNCWebView.h # ios/RNCWebView.m # ios/RNCWebViewManager.m # js/WebView.android.js # js/WebView.ios.js # js/WebViewTypes.js # typings/index.d.ts
# [7.1.0](react-native-webview/react-native-webview@v7.0.7...v7.1.0) (2019-09-21) ### Bug Fixes * **iOS:** Call dispatchViewManagerCommand with correct number of arguments ([react-native-webview#886](react-native-webview#886)) ([33f1ee3](react-native-webview@33f1ee3)) * **iOS:** inconsistent backgroundColor ([react-native-webview#868](react-native-webview#868)) ([d25b20a](react-native-webview@d25b20a)) ### Features * **iOS:** Allow custom CA to be used on webview requests ([react-native-webview#865](react-native-webview#865)) ([136fbd8](react-native-webview@136fbd8)) * **new prop:** onHttpError callback ([react-native-webview#885](react-native-webview#885)) ([552472c](react-native-webview@552472c))
# [7.1.0](react-native-webview/react-native-webview@v7.0.7...v7.1.0) (2019-09-21) ### Bug Fixes * **iOS:** Call dispatchViewManagerCommand with correct number of arguments ([#886](react-native-webview/react-native-webview#886)) ([33f1ee3](react-native-webview/react-native-webview@33f1ee3)) * **iOS:** inconsistent backgroundColor ([#868](react-native-webview/react-native-webview#868)) ([d25b20a](react-native-webview/react-native-webview@d25b20a)) ### Features * **iOS:** Allow custom CA to be used on webview requests ([#865](react-native-webview/react-native-webview#865)) ([136fbd8](react-native-webview/react-native-webview@136fbd8)) * **new prop:** onHttpError callback ([#885](react-native-webview/react-native-webview#885)) ([552472c](react-native-webview/react-native-webview@552472c))
# [7.1.0](react-native-webview/react-native-webview@v7.0.7...v7.1.0) (2019-09-21) ### Bug Fixes * **iOS:** Call dispatchViewManagerCommand with correct number of arguments ([#886](react-native-webview/react-native-webview#886)) ([33f1ee3](react-native-webview/react-native-webview@33f1ee3)) * **iOS:** inconsistent backgroundColor ([#868](react-native-webview/react-native-webview#868)) ([d25b20a](react-native-webview/react-native-webview@d25b20a)) ### Features * **iOS:** Allow custom CA to be used on webview requests ([#865](react-native-webview/react-native-webview#865)) ([136fbd8](react-native-webview/react-native-webview@136fbd8)) * **new prop:** onHttpError callback ([#885](react-native-webview/react-native-webview#885)) ([552472c](react-native-webview/react-native-webview@552472c))
Summary
This PR adds an
onHttpError
callback which notifies the host app that an error http status code is received.After finishing the code I found out there's already a closed PR for this feature but it never get merged, so I figure I'll just mention it here and I've also addressed to most of the comments in that PR.
Http error callback (Catch http error statuscode) #558
It's useful to be able to get the error status code in the webview, so that we can have different error handlings based on the status code (e.g. refresh token on
401
).Requests for nested frames are filtered out, so
onHttpError
will only be called on the main frame.The native event returned from this callback will contain:
statusCode
: The http error status code.description
: Description of the error status code (only onAndroid
).Implementation:
iOS
:decidePolicyForNavigationResponse
Android
:onReceivedHttpError
(introduced in API level 23)Fixes #189
Fixes #807
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md
CHANGELOG.md
example/App.js
)