public string ToString(string format, IFormatProvider formatProvider) { var request = Context.Request; switch (format) { case "all": var buffer = StringBuilderPool.GetOut(); buffer.Append(request.HttpMethod); buffer.Append(" "); buffer.Append(request.Url); buffer.Append(" "); buffer.AppendLine(request.RequestType); var headers = request.Headers; foreach (var key in headers.AllKeys) { foreach (var value in headers.GetValues(key)) { buffer.Append(key); buffer.Append(":"); buffer.AppendLine(value); } } buffer.AppendLine(); buffer.Append((request.ContentType.GetEncoding() ?? Encoding.Default).GetString(Body)); return(StringBuilderPool.Return(buffer)); case "body": case null: default: return((request.ContentType.GetEncoding() ?? Encoding.Default).GetString(Body)); } }
public string ToString(string format, IFormatProvider formatProvider) { var request = OwinContext.Request; switch (format) { case "all": var buffer = StringBuilderPool.GetOut(); buffer.Append(request.Method); buffer.Append(" "); buffer.Append(request.Uri); buffer.Append(" "); buffer.AppendLine(request.Protocol); foreach (var header in request.Headers) { foreach (var value in header.Value) { buffer.Append(header.Key); buffer.Append(":"); buffer.AppendLine(value); } } buffer.AppendLine(); buffer.Append((request.ContentType.GetEncoding() ?? Encoding.Default).GetString(Body)); return(StringBuilderPool.Return(buffer)); case "body": case null: default: return((request.ContentType.GetEncoding() ?? Encoding.Default).GetString(Body)); } }