mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 19:54:53 +00:00
Demo Post data for #1267
This commit is contained in:
@@ -17,6 +17,7 @@ namespace CefSharp.Example
|
||||
public const string BindingTestUrl = "custom://cefsharp/BindingTest.html";
|
||||
public const string PluginsTestUrl = "custom://cefsharp/plugins.html";
|
||||
public const string PopupTestUrl = "custom://cefsharp/PopupTest.html";
|
||||
public const string BasicSchemeTestUrl = "custom://cefsharp/SchemeTest.html";
|
||||
public const string TestResourceUrl = "http://test/resource/load";
|
||||
public const string RenderProcessCrashedUrl = "http://processcrashed";
|
||||
public const string TestUnicodeResourceUrl = "http://test/resource/loadUnicode";
|
||||
|
||||
@@ -51,6 +51,15 @@ namespace CefSharp.Example
|
||||
var uri = new Uri(request.Url);
|
||||
var fileName = uri.AbsolutePath;
|
||||
|
||||
if(string.Equals(fileName, "/PostDataTest.html", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var resourceHandler = ResourceHandler.FromString("Post Data: " + request.PostData.Elements[0].GetBody());
|
||||
stream = (MemoryStream)resourceHandler.Stream;
|
||||
mimeType = "text/html";
|
||||
callback.Continue();
|
||||
return true;
|
||||
}
|
||||
|
||||
string resource;
|
||||
if (ResourceDictionary.TryGetValue(fileName, out resource) && !string.IsNullOrEmpty(resource))
|
||||
{
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Scheme Handler Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Success</h1>
|
||||
<p>Scheme Handler Functioned Correctly</p>
|
||||
</body>
|
||||
<head>
|
||||
<title>Scheme Handler Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Success</h1>
|
||||
<p>Scheme Handler Functioned Correctly</p>
|
||||
|
||||
<form action="custom://cefsharp/PostDataTest.html" method="post" target="_blank">
|
||||
User:<input type="text" name="user" value="lion" />
|
||||
<br>
|
||||
Pass:<input type="text" name="pass" value="123" />
|
||||
<br>
|
||||
<input type="submit" value="Test POST Data" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,6 +20,7 @@
|
||||
<MenuItem Header="_List Plugins" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="ListPlugins"/>
|
||||
<MenuItem Header="_Popup Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="PopupTest"/>
|
||||
<MenuItem Header="_Popup Test Custom Scheme" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="PopupTestCustomScheme"/>
|
||||
<MenuItem Header="_Basic Scheme Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="BasicSchemeTest"/>
|
||||
<MenuItem Header="_Fish Gl" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="FishGl"/>
|
||||
<MenuItem Header="_Microsoft Test Drive" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="MsTestDrive"/>
|
||||
<MenuItem Header="_Drag Demo" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="DragDemo"/>
|
||||
|
||||
@@ -121,6 +121,11 @@ namespace CefSharp.Wpf.Example
|
||||
url = CefExample.PopupTestUrl;
|
||||
break;
|
||||
}
|
||||
case "BasicSchemeTest":
|
||||
{
|
||||
url = CefExample.BasicSchemeTestUrl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(url))
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CefSharp
|
||||
/// <param name="postDataElement">post data</param>
|
||||
/// <param name="charSet">character set</param>
|
||||
/// <returns>encoded string</returns>
|
||||
public static string GetBody(this IPostDataElement postDataElement, string charSet)
|
||||
public static string GetBody(this IPostDataElement postDataElement, string charSet = null)
|
||||
{
|
||||
var bytes = postDataElement.Bytes;
|
||||
if(bytes.Length == 0)
|
||||
|
||||
Reference in New Issue
Block a user