-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[webview_flutter_platform_interface] Adds WebResourceRequest to HttpResponseError #4025
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 all commits
12588bf
5016358
c7600f0
bc00802
71f3d19
9c519f5
1cdaa00
66986c2
7e861b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
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 String? uri; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I know I said we should go back to |
||
|
||
/// The HTTP status code. | ||
final int statusCode; | ||
|
||
/// Headers for the request. | ||
final Map<String, String> headers; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.