private static RequestTrace CreateRequestTrace(TraceRecord traceRecord) { HttpRequestMessage request = traceRecord.Request; RequestTrace requestTrace = new RequestTrace { Id = traceRecord.RequestId.ToString(), Method = (request == null) ? String.Empty : request.Method.ToString(), Uri = (request == null || request.RequestUri == null) ? String.Empty : request.RequestUri.ToString(), Timestamp = traceRecord.Timestamp, Status = (int) traceRecord.Status, Reason = traceRecord.Status == 0 ? null : traceRecord.Status.ToString() }; return requestTrace; }
private static bool IsMatch(RequestTrace requestTrace, string httpMethod, string path) { string baseUri = EncodedPathFromUri(requestTrace.Uri); return ((httpMethod == null || requestTrace.Method.Equals(httpMethod, StringComparison.OrdinalIgnoreCase)) && (path == null || baseUri.Equals(path, StringComparison.OrdinalIgnoreCase))); }