/// <summary> /// Create a new context with only request and response header collections. /// </summary> public MiddlewareContext() { IDictionary <string, object> environment = new Dictionary <string, object>(StringComparer.Ordinal); environment[MiddlewareOwinConstants.RequestHeaders] = new Dictionary <string, string[]>(StringComparer.OrdinalIgnoreCase); environment[MiddlewareOwinConstants.ResponseHeaders] = new Dictionary <string, string[]>(StringComparer.OrdinalIgnoreCase); Environment = environment; Request = new MiddlewareRequest(environment); Response = new MiddlewareResponse(environment); }
/// <summary> /// Create a new wrapper. /// </summary> /// <param name="environment">OWIN environment dictionary which stores state information about the request, response and relevant server state.</param> public MiddlewareContext(IDictionary <string, object> environment) { if (environment is null) { throw new ArgumentNullException(nameof(environment)); } Environment = environment; Request = new MiddlewareRequest(environment); Response = new MiddlewareResponse(environment); }