Skip to content

Commit

Permalink
fix TestConsoleApp
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Apr 15, 2017
1 parent 745e5db commit 4106b2d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/TestConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ public static void Main(string[] args)
listener.Request += HandleRequest;
listener.Start();

bool isListening = listener.IsListening;
Console.WriteLine("isListening = {0} at port {1}", isListening, port);
Console.WriteLine($"Start an internet browser and navigate to http://localhost:{port}");

Console.WriteLine("Press any key to stop listener");

Console.ReadKey();
listener.Close();
listener.Dispose();
Expand All @@ -29,7 +28,7 @@ private static async void HandleRequest(object sender, HttpListenerRequestEventA
var request = e.Request;
var response = e.Response;

if (request.Method == HttpMethods.Get)
if (request.HttpMethod == HttpMethods.Get)
{
string content = @"<h2>Hello! What's your name?</h2>
<form method=""POST"" action=""/?test=2"">
Expand All @@ -39,9 +38,9 @@ private static async void HandleRequest(object sender, HttpListenerRequestEventA

await response.WriteContentAsync(MakeDocument(content));
}
else if (request.Method == HttpMethods.Post)
else if (request.HttpMethod == HttpMethods.Post)
{
var param = request.RequestUri.ParseQueryParameters();
var param = request.Url.ParseQueryParameters();

var data = await request.ReadUrlEncodedContentAsync();
var name = data["name"];
Expand Down

0 comments on commit 4106b2d

Please sign in to comment.