Esempio n. 1
0
        /// <summary>Gets request information.</summary>
        ///
        /// <param name="httpReq">The HTTP request.</param>
        ///
        /// <returns>The request information.</returns>
        public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
        {
            var response = new RequestInfoResponse
            {
                Host                = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.NServiceKitVersion + "_" + EndpointHost.Config.ServiceName,
                Date                = DateTime.UtcNow,
                ServiceName         = EndpointHost.Config.ServiceName,
                UserHostAddress     = httpReq.UserHostAddress,
                HttpMethod          = httpReq.HttpMethod,
                AbsoluteUri         = httpReq.AbsoluteUri,
                RawUrl              = httpReq.RawUrl,
                ResolvedPathInfo    = httpReq.PathInfo,
                ContentType         = httpReq.ContentType,
                Headers             = ToDictionary(httpReq.Headers),
                QueryString         = ToDictionary(httpReq.QueryString),
                FormData            = ToDictionary(httpReq.FormData),
                AcceptTypes         = new List <string>(httpReq.AcceptTypes ?? new string[0]),
                ContentLength       = httpReq.ContentLength,
                OperationName       = httpReq.OperationName,
                ResponseContentType = httpReq.ResponseContentType,
            };

            return(response);
        }
Esempio n. 2
0
        /// <summary>Gets request information.</summary>
        ///
        /// <param name="httpReq">The HTTP request.</param>
        ///
        /// <returns>The request information.</returns>
		public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
		{
			var response = new RequestInfoResponse
			{
				Host = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.NServiceKitVersion + "_" + EndpointHost.Config.ServiceName,
				Date = DateTime.UtcNow,
				ServiceName = EndpointHost.Config.ServiceName,
				UserHostAddress = httpReq.UserHostAddress,
				HttpMethod = httpReq.HttpMethod,
				AbsoluteUri = httpReq.AbsoluteUri,
				RawUrl = httpReq.RawUrl,
				ResolvedPathInfo = httpReq.PathInfo,
				ContentType = httpReq.ContentType,
				Headers = ToDictionary(httpReq.Headers),
				QueryString = ToDictionary(httpReq.QueryString),
				FormData = ToDictionary(httpReq.FormData),
				AcceptTypes = new List<string>(httpReq.AcceptTypes ?? new string[0]),
				ContentLength = httpReq.ContentLength,
				OperationName = httpReq.OperationName,
				ResponseContentType = httpReq.ResponseContentType,
			};
			return response;
		}