public void map_from_execution_when_the_request_was_redirected() { var log = new ChainExecutionLog(); log.Request.Add(OwinConstants.ResponseStatusCodeKey, 302); log.Request.ResponseHeaders().Add(HttpResponseHeaders.ContentType, new[] { "text/plain" }); log.Request.ResponseHeaders().Add(HttpResponseHeaders.Location, new[] { "/new/place" }); var request = new OwinHttpRequest(log.Request); request.HttpMethod("GET"); request.FullUrl("http://server/foo"); log.MarkFinished(); var summary = new HttpRequestSummary(log); summary.id.ShouldBe(log.Id.ToString()); summary.time.ShouldBe(log.Time.ToHttpDateString()); summary.url.ShouldBe("/foo"); summary.method.ShouldBe("GET"); summary.status.ShouldBe(302); summary.contentType.ShouldBe("text/plain"); summary.duration.ShouldBe(log.ExecutionTime); summary.description.ShouldBe("/new/place"); }
public string ToHtml() { var table = new TableTag(); table.AddClass("table"); table.AddClass("table-striped"); table.AddHeaderRow(row => { row.Header("Details"); row.Header("Duration (ms)"); row.Header("Method"); row.Header("Endpoint"); row.Header("Status"); row.Header("Content Type"); }); _logs.Each(log => { var url = _runtime.BaseAddress.TrimEnd('/') + "/_fubu/#/fubumvc/request-details/" + log.Id; table.AddBodyRow(row => { row.Cell().Add("a").Text("Details").Attr("href", url).Attr("target", "_blank"); row.Cell(log.ExecutionTime.ToString()).Attr("align", "right"); var summary = new HttpRequestSummary(log); row.Cell(summary.method); row.Cell(log.Title()); row.Cell(summary.status.ToString()); row.Cell(summary.contentType); }); }); return(table.ToString()); }
public void map_from_execution_log_happy_path() { var log = new ChainExecutionLog(); log.Request.Add(OwinConstants.ResponseStatusCodeKey, 200); log.Request.ResponseHeaders().Add(HttpResponseHeaders.ContentType, new [] { "text/plain" }); var request = new OwinHttpRequest(log.Request); request.HttpMethod("POST"); request.FullUrl("http://server/foo"); log.MarkFinished(); var summary = new HttpRequestSummary(log); summary.id.ShouldBe(log.Id.ToString()); summary.time.ShouldBe(log.Time.ToHttpDateString()); summary.url.ShouldBe("/foo"); summary.method.ShouldBe("POST"); summary.status.ShouldBe(200); summary.contentType.ShouldBe("text/plain"); summary.duration.ShouldBe(log.ExecutionTime); }