Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Request"/> class.
 /// </summary>
 /// <param name="arbitraryKeyValuePairs">The arbitrary key value pairs.</param>
 /// <param name="httpAttributes">The Rollbar HTTP attributes.</param>
 public Request(
     IDictionary <string, object> arbitraryKeyValuePairs
     , RollbarHttpAttributes httpAttributes
     )
     : base(arbitraryKeyValuePairs)
 {
     if (httpAttributes != null)
     {
         this.SnapProperties(httpAttributes);
     }
 }
Esempio n. 2
0
        private void SnapProperties(RollbarHttpAttributes httpContext)
        {
            Assumption.AssertNotNull(httpContext, nameof(httpContext));

            this.Url         = httpContext.Host.Value + httpContext.Path;
            this.QueryString = httpContext.Query.Value;
            this.Params      = null;

            this.Headers = new Dictionary <string, string>(httpContext.Headers.Count());
            foreach (var header in httpContext.Headers)
            {
                if (header.Value.Count() == 0)
                {
                    continue;
                }

                this.Headers.Add(header.Key, StringUtility.Combine(header.Value, ", "));
            }

            this.Method = httpContext.Method;
        }