示例#1
0
        public static void AddToHttpResponseHeader(this MiniProfiler miniProfiler, HttpResponse httpResponse)
        {
            string miniProfilerJson           = JsonConvert.SerializeObject(miniProfiler);
            string miniProfilerJsonCompressed = GZipUtils.Zip(miniProfilerJson);

            httpResponse.Headers.Add(MiniProfilerResultsHeaderName, miniProfilerJsonCompressed);
        }
示例#2
0
        public static void TryAddMiniProfilerResultsFromHeader(this MiniProfiler miniProfiler, HttpResponseMessage httpResponseMessage)
        {
            IEnumerable <string> values;

            if (httpResponseMessage.Headers.TryGetValues(MiniProfilerResultsHeaderName, out values))
            {
                string       miniProfilerJsonCompressed = values.First();
                string       miniProfilerJson           = GZipUtils.Unzip(miniProfilerJsonCompressed);
                MiniProfiler remoteMiniProfiler         = JsonConvert.DeserializeObject <MiniProfiler>(miniProfilerJson);

                miniProfiler.AddProfilerResults(remoteMiniProfiler);
            }
        }