Example #1
0
        private static string GetBody(Request request)
        {
            if (request.BodyIgnored)
            {
                return "Body ignored";
            }

            if (request.Body.Empty())
            {
                return "No body";
            }

            try
            {
                if (request.ContentType.Contains("json", StringComparison.InvariantCultureIgnoreCase))
                {
                    return request.Body.ToFormattedJson();
                }

                if (request.ContentType.Contains("xml", StringComparison.InvariantCultureIgnoreCase))
                {
                    return request.Body.ToFormattedXml();
                }
            }
            catch
            {
                return request.Body;
            }

            return request.Body;
        }
Example #2
0
 public static RequestViewModel Create(Request request)
 {
     return Mapper.Map<RequestViewModel>(request);
 }
Example #3
0
 private static List<NameValueListViewModel> ToNameValueListViewModels(Request request)
 {
     return request.Headers
         .OrderBy(h => h.Name)
         .Select(h => new NameValueListViewModel(h.Name, h.Value))
         .ToList();
 }