// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.IO; using System.Threading.Tasks; namespace Microsoft.AspNetCore.Http.Features { /// /// Represents the fields and state of an HTTP response. /// public interface IHttpResponseFeature { /// /// The status-code as defined in RFC 7230. The default value is 200. /// int StatusCode { get; set; } /// /// The reason-phrase as defined in RFC 7230. Note this field is no longer supported by HTTP/2. /// string ReasonPhrase { get; set; } /// /// The response headers to send. Headers with multiple values will be emitted as multiple headers. /// IHeaderDictionary Headers { get; set; } /// /// The for writing the response body. /// Stream Body { get; set; } /// /// Indicates if the response has started. If true, the , /// , and are now immutable, and /// OnStarting should no longer be called. /// bool HasStarted { get; } /// /// Registers a callback to be invoked just before the response starts. This is the /// last chance to modify the , , or /// . /// /// The callback to invoke when starting the response. /// The state to pass into the callback. void OnStarting(Func callback, object state); /// /// Registers a callback to be invoked after a response has fully completed. This is /// intended for resource cleanup. /// /// The callback to invoke after the response has completed. /// The state to pass into the callback. void OnCompleted(Func callback, object state); } }