private HttpServer( HttpListener listener, CancellationTokenSource canceller, RequestRecorder recorder, Uri uri ) { _listener = listener; _canceller = canceller; _recorder = recorder; Uri = uri; }
/// <summary> /// Creates a <see cref="RequestRecorder"/> that captures requests. /// </summary> /// <remarks> /// You won't normally need to use this directly, since the <see cref="HttpServer"/> has a /// <see cref="RequestRecorder"/> built in, but you could use it to capture a subset of /// requests. /// </remarks> /// <example> /// <code> /// var handler = Handlers.Record(out var recorder).Then(Handlers.Status(200)); /// </code> /// </example> /// <param name="recorder">receives the new <see cref="RequestRecorder"/> instance</param> /// <returns>a <see cref="Handler"/> that will pass requests to the recorder</returns> public static Handler Record(out RequestRecorder recorder) { recorder = new RequestRecorder(); return(recorder.Handler); }