private static RollbarRequest GetRollbarRequest(NancyContext context) { var rr = new RollbarRequest { Url = context.Request.Url.ToString(), Method = context.Request.Method, Headers = context.Request.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)), Params = ((IDictionary<string, object>)context.Parameters).ToDictionary(x => x.Key, x => x.Value), UserIp = context.Request.UserHostAddress, }; if (rr.Params.Count == 0) { rr.Params = null; } if (rr.Method == "GET") { rr.GetParams = ((IDictionary<string, object>) context.Request.Query).ToDictionary(x => x.Key, x => x.Value); if (rr.GetParams.Count == 0) { rr.GetParams = null; } } if (rr.Method == "POST") { rr.PostParams = ((IDictionary<string, object>) context.Request.Form) .Concat((IDictionary<string, object>) context.Parameters) .ToDictionary(x => x.Key, x => x.Value); if (rr.PostParams.Count == 0) { rr.PostParams = null; } rr.PostBody = context.Request.Body.AsString(); } return rr; }
public RollbarRequestFixture() { this._rollbarRequest = new RollbarRequest(); }