The Request information is stored in the Http interface. Two arguments are required: url and method.
Inheritance: ISentryRequest
コード例 #1
0
        /// <summary>
        /// Called when the <see cref="JsonPacket" /> has been created. Can be overridden to
        /// adjust the values of the <paramref name="jsonPacket" /> before it is sent to Sentry.
        /// </summary>
        /// <param name="jsonPacket">The json packet.</param>
        /// <returns>
        /// The <see cref="JsonPacket" />.
        /// </returns>
        protected override JsonPacket OnCreate(JsonPacket jsonPacket)
        {
            var nancyContext = CallContext.LogicalGetData(NancyConfiguration.NancyContextDataSlot) as NancyContext;

            if (nancyContext == null)
            {
                return(jsonPacket);
            }

            var sentryRequest = NancySentryRequest.GetRequest(nancyContext);

            if (sentryRequest == null)
            {
                return(jsonPacket);
            }

            jsonPacket.Request = sentryRequest;
            jsonPacket.User    = sentryRequest.GetUser();

            return(jsonPacket);
        }
コード例 #2
0
 /// <summary>
 /// Gets the request.
 /// </summary>
 /// <returns>
 /// If an HTTP contest is available, an instance of <see cref="NancySentryRequest"/>, otherwise <c>null</c>.
 /// </returns>
 public static NancySentryRequest GetRequest(NancyContext httpContext)
 {
     var request = new NancySentryRequest(httpContext);
     return request.HasHttpContext ? request : null;
 }
コード例 #3
0
        /// <summary>
        /// Gets the request.
        /// </summary>
        /// <returns>
        /// If an HTTP contest is available, an instance of <see cref="NancySentryRequest"/>, otherwise <c>null</c>.
        /// </returns>
        public static NancySentryRequest GetRequest(NancyContext httpContext)
        {
            var request = new NancySentryRequest(httpContext);

            return(request.HasHttpContext ? request : null);
        }