示例#1
0
 public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
 {
     var response = new RequestInfoResponse
     {
         Host = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.ServiceStackVersion + "_" + 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;
 }
示例#2
0
        public static RequestInfoResponse GetRequestInfo(IHttpRequest httpReq)
        {
            var response = new RequestInfoResponse
            {
                Host                = EndpointHost.Config.DebugHttpListenerHostEnvironment + "_v" + Env.ServiceStackVersion + "_" + 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);
        }