Beispiel #1
0
        protected Dictionary <string, string[]> CollectHttpResponseHeaders(MessageProperties properties)
        {
            if (properties == null || properties.Count == 0)
            {
                return(null);
            }

            var httpResponse = GetProperty <HttpResponseMessageProperty>(properties, HttpResponseMessageProperty.Name);

            return(httpResponse == null ? null : HttpInspector.CollectHeadersSafely(httpResponse.Headers));
        }
Beispiel #2
0
        private Response ExtractResponseData(IOwinContext owinContext, MemoryStream responseBodyStream)
        {
            var data = new Response
            {
                Headers = HttpInspector.CollectHeadersSafely(owinContext.Request.Headers.ToDictionary(
                                                                 kvp => kvp.Key.ToLowerInvariant(),
                                                                 kvp => kvp.Value.ToArray())),
                Body   = responseBodyStream.ReadAsString(),
                Status = _context.Response.StatusCode
            };

            return(data);
        }
Beispiel #3
0
        private static Request ExtractRequestData(IOwinContext owinContext, MemoryStream requestBodyStream)
        {
            var data = new Request
            {
                Headers = HttpInspector.CollectHeadersSafely(owinContext.Request.Headers.ToDictionary(
                                                                 kvp => kvp.Key.ToLowerInvariant(),
                                                                 kvp => kvp.Value.ToArray())),
                Uri    = owinContext.Request.Uri.ToString(),
                Method = owinContext.Request.Method,
                Body   = !SensitiveUrls.Contains(owinContext.Request.Uri.AbsolutePath) ? requestBodyStream.ReadAsString() : HttpInspector.RemoveSensitiveData(requestBodyStream.ReadAsString())
            };

            return(data);
        }