public object Any(GetRequestInfo request) { return(new RequestInfoResponse { HttpMethod = Request.Verb, RawUrl = Request.RawUrl, AbsoluteUri = Request.AbsoluteUri, PathInfo = Request.PathInfo, }); }
//中间件得到请求的信息 private static void HandleMapReqinfo(IApplicationBuilder app) { Console.WriteLine("--------进入HandleMapTest函数--------"); app.Run(async context => { //解决中文显示编码问题 context.Response.ContentType = "text/plain; charset=utf-8"; await context.Response.WriteAsync(GetRequestInfo.GetRequestInfomation(context.Request)); }); //await context.Response.WriteAsync(HtmlEncoder.Create(UnicodeRanges.All).Encode(GetRequestInfo.GetRequestInfomation(context.Request))); }
/// <summary> /// Callback giving you the opportunity to set the state before it is /// retrieved due to a request. The requestInfo parameter will be /// either a GetElementRequestInfo class, or a GetAllRequestInfo class. /// Use the "is" keyword to find out which one (and thus what type the /// request was). This class, once casted to the right type, contains /// information about the specific request. See the Vector class /// description for more information. /// </summary> protected virtual void GetCallback(GetRequestInfo request) { }