Skip to content

Instantly share code, notes, and snippets.

View kkolodziejczak's full-sized avatar

Krzysztof Kołodziejczak kkolodziejczak

View GitHub Profile
@kkolodziejczak
kkolodziejczak / in-memory-http-server.cs
Created March 11, 2019 19:00 — forked from yetanotherchris/in-memory-http-server.cs
In memory http server for C# unit and integration tests
public static Task BasicHttpServer(string url, string outputHtml)
{
return Task.Run(() =>
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add(url);
listener.Start();
// GetContext method blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();