public override async Task ProgressTask(WebProgressTask task) { _ = task ?? throw new ArgumentNullException(nameof(task)); var source = new HttpStringDataSource(Document) { MimeType = MimeType.TextHtml }; task.Response.StatusCode = HttpStateCode.OK; task.Document.DataSources.Add(source); task.Document.PrimaryEncoding = "utf-8"; await Task.CompletedTask.ConfigureAwait(false); }
public override async Task ProgressTask(WebProgressTask task) { _ = task ?? throw new ArgumentNullException(nameof(task)); switch (task.Request.ProtocolMethod) { case HttpProtocolMethod.Head: task.Document.Information["Only Header"] = true; break; case HttpProtocolMethod.Options: { var source = new HttpStringDataSource("GET\r\nPOST\r\nHEAD\r\nOPTIONS\r\nTRACE") { MimeType = MimeType.TextPlain, }; task.Document.DataSources.Add(source); task.NextStage = ServerStage.CreateResponse; } break; } await Task.CompletedTask.ConfigureAwait(false); }