-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[webview_platform_interface] Adds WebResourceRequest to HttpResponseError #5790
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
Changes from 13 commits
12588bf
5016358
c7600f0
bc00802
71f3d19
9c519f5
1cdaa00
66986c2
7e861b7
6df7c99
88af241
2daf57b
30475ac
87be1a4
281f8fa
1ddc2f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/foundation.dart'; | ||
|
|
||
| /// Defines the parameters of the web resource request from the associated request. | ||
| /// | ||
| /// Platform specific implementations can add additional fields by extending | ||
| /// this class. | ||
| /// | ||
| /// This example demonstrates how to extend the [WebResourceRequest] to | ||
| /// provide additional platform specific parameters. | ||
| /// | ||
| /// When extending [WebResourceRequest] additional parameters should always | ||
| /// accept `null` or have a default value to prevent breaking changes. | ||
| /// | ||
| /// ```dart | ||
| /// class AndroidWebResourceRequest extends WebResourceRequest { | ||
| /// WebResourceRequest._({ | ||
| /// required WebResourceRequest request, | ||
| /// }) : super( | ||
| /// uri: request.uri, | ||
| /// ); | ||
| /// | ||
| /// factory AndroidWebResourceRequest.fromWebResourceRequest( | ||
| /// WebResourceRequest request, { | ||
| /// Map<String, String> headers, | ||
| /// }) { | ||
| /// return AndroidWebResourceRequest._(request, headers: headers); | ||
| /// } | ||
| /// | ||
| /// final Map<String, String> headers; | ||
| /// } | ||
| /// ``` | ||
| @immutable | ||
| class WebResourceRequest { | ||
| /// Used by the platform implementation to create a new [WebResourceRequest]. | ||
| const WebResourceRequest({required this.uri}); | ||
|
|
||
| /// URI for the request. | ||
| final Uri uri; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/foundation.dart'; | ||
|
|
||
| /// Contains information about the response for a request. | ||
| /// | ||
| /// Platform specific implementations can add additional fields by extending | ||
| /// this class. | ||
| /// | ||
| /// This example demonstrates how to extend the [WebResourceResponse] to | ||
| /// provide additional platform specific parameters. | ||
| /// | ||
| /// When extending [WebResourceResponse] additional parameters should always | ||
| /// accept `null` or have a default value to prevent breaking changes. | ||
| /// | ||
| /// ```dart | ||
| /// class AndroidWebResourceResponse extends WebResourceResponse { | ||
| /// WebResourceResponse._({ | ||
| /// required WebResourceResponse response, | ||
| /// }) : super( | ||
| /// uri: response.uri, | ||
| /// statusCode: response.statusCode, | ||
| /// headers: response.headers, | ||
| /// ); | ||
| /// | ||
| /// factory AndroidWebResourceResponse.fromWebResourceResponse( | ||
| /// WebResourceResponse response, { | ||
| /// Uri? historyUrl, | ||
| /// }) { | ||
| /// return AndroidWebResourceResponse._(response, historyUrl: historyUrl); | ||
| /// } | ||
| /// | ||
| /// final Uri? historyUrl; | ||
| /// } | ||
| /// ``` | ||
| @immutable | ||
| class WebResourceResponse { | ||
| /// Used by the platform implementation to create a new [WebResourceResponse]. | ||
| const WebResourceResponse({ | ||
| required this.uri, | ||
| required this.statusCode, | ||
| this.headers = const <String, String>{}, | ||
| }); | ||
|
|
||
| /// The URI that this response is associated with. | ||
| final Uri? uri; | ||
|
|
||
| /// The HTTP status code. | ||
| final int statusCode; | ||
|
|
||
| /// Headers for the request. | ||
| final Map<String, String> headers; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' | ||
| as main_file; | ||
|
|
||
| void main() { | ||
| group('webview_flutter_platform_interface', () { | ||
| test( | ||
| 'ensures webview_flutter_platform_interface.dart exports classes in types directory', | ||
| () { | ||
| // ignore: unnecessary_statements | ||
|
||
| main_file.JavaScriptConsoleMessage; | ||
| // ignore: unnecessary_statements | ||
| main_file.JavaScriptLogLevel; | ||
| // ignore: unnecessary_statements | ||
| main_file.JavaScriptMessage; | ||
| // ignore: unnecessary_statements | ||
| main_file.JavaScriptMode; | ||
| // ignore: unnecessary_statements | ||
| main_file.LoadRequestMethod; | ||
| // ignore: unnecessary_statements | ||
| main_file.NavigationDecision; | ||
| // ignore: unnecessary_statements | ||
| main_file.NavigationRequest; | ||
| // ignore: unnecessary_statements | ||
| main_file.NavigationRequestCallback; | ||
| // ignore: unnecessary_statements | ||
| main_file.PageEventCallback; | ||
| // ignore: unnecessary_statements | ||
| main_file.PlatformNavigationDelegateCreationParams; | ||
| // ignore: unnecessary_statements | ||
| main_file.PlatformWebViewControllerCreationParams; | ||
| // ignore: unnecessary_statements | ||
| main_file.PlatformWebViewCookieManagerCreationParams; | ||
| // ignore: unnecessary_statements | ||
| main_file.PlatformWebViewPermissionRequest; | ||
| // ignore: unnecessary_statements | ||
| main_file.PlatformWebViewWidgetCreationParams; | ||
| // ignore: unnecessary_statements | ||
| main_file.ProgressCallback; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebViewPermissionResourceType; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebResourceRequest; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebResourceResponse; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebResourceError; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebResourceErrorCallback; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebViewCookie; | ||
| // ignore: unnecessary_statements | ||
| main_file.WebResourceErrorType; | ||
| // ignore: unnecessary_statements | ||
| main_file.UrlChange; | ||
| }, | ||
| ); | ||
| }); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.