-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proxy requests and round trip JavaScript invocations (#43)
* Add support for proxying requests sent by HybridWebView: Proxying web requests from the browser through native code to allow for modifying the request, and creating custom responses. * Add round trip invoke JS-.NET-JS: Add round trip invoke JS-.NET-JS by leveraging the proxy framework that was created.
- Loading branch information
1 parent
e962a50
commit 2c777e2
Showing
21 changed files
with
826 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace HybridWebView | ||
{ | ||
/// <summary> | ||
/// Event arg object for a proxy request from the <see cref="HybridWebView"/>. | ||
/// </summary> | ||
public class HybridWebViewProxyEventArgs | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="HybridWebViewProxyEventArgs"/>. | ||
/// </summary> | ||
/// <param name="fullUrl">The full request URL.</param> | ||
public HybridWebViewProxyEventArgs(string fullUrl) | ||
{ | ||
Url = fullUrl; | ||
QueryParams = QueryStringHelper.GetKeyValuePairs(fullUrl); | ||
} | ||
|
||
/// <summary> | ||
/// The full request URL. | ||
/// </summary> | ||
public string Url { get; } | ||
|
||
/// <summary> | ||
/// Query string values extracted from the request URL. | ||
/// </summary> | ||
public IDictionary<string, string> QueryParams { get; } | ||
|
||
/// <summary> | ||
/// The response content type. | ||
/// </summary> | ||
|
||
public string? ResponseContentType { get; set; } = "text/plain"; | ||
|
||
/// <summary> | ||
/// The response stream to be used to respond to the request. | ||
/// </summary> | ||
public Stream? ResponseStream { get; set; } = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.