/// <summary> /// 创建上下文环境 /// </summary> /// <param name="client"></param> /// <param name="request"></param> /// <returns></returns> public override HttpContext <T> GetContext <T>(HttpClient client, HttpRequestMessage request) { var ctx = new HttpContext <T>(client, request); //附加监听器 if (client.Monitor != null) { ctx.AttachMonitor(client.Monitor); } return(ctx); }
/// <summary> /// 创建上下文环境 /// </summary> /// <param name="client"></param> /// <param name="request"></param> /// <returns></returns> public virtual HttpContext<T> GetContext<T>(HttpClient client, HttpRequestMessage request) where T : class { var ctx = new HttpContext<T>(client, request); //附加监听器 if (client.Monitor != null) ctx.AttachMonitor(client.Monitor); var e = new HttpHandlerEventArgs(null, ctx); OnHttpContextCreated(e); return e.HttpContext as HttpContext<T>; }
/// <summary> /// 创建上下文环境 /// </summary> /// <param name="client"></param> /// <param name="request"></param> /// <returns></returns> public override HttpContext GetContext(HttpClient client, HttpRequestMessage request) { //证书 client.Setting.CertificateManager?.SetRequest(request); var ctx = new HttpContext(client, request); //附加监听器 if (client.Monitor != null) { ctx.AttachMonitor(client.Monitor); } return(ctx); }
/// <summary> /// 创建上下文环境 /// </summary> /// <param name="client"></param> /// <param name="request"></param> /// <returns></returns> public virtual HttpContext GetContext(HttpClient client, HttpRequestMessage request) { //证书 client.Setting.CertificateManager?.SetRequest(request); var ctx = new HttpContext(client, request); //附加监听器 if (client.Monitor != null) ctx.AttachMonitor(client.Monitor); var e = new HttpHandlerEventArgs(null, ctx); OnHttpContextCreated(e); return e.HttpContext; }