Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
interface Microsoft.​AspNetCore.​Http.​Features.​IHttpResponseFeature
Assembly: Microsoft.AspNetCore.Http.Features
Represents the fields and state of an HTTP response.
Properties
int
StatusCode
Gets or sets the status-code as defined in RFC 7230.
string
ReasonPhrase
Gets or sets the reason-phrase as defined in RFC 7230. Note this field is no longer supported by HTTP/2.
Headers
Gets or sets the response headers to send. Headers with multiple values will be emitted as multiple headers.
Gets or sets the <see cref="T:System.IO.Stream" /> for writing the response body.
bool
HasStarted
Gets a value that indicates if the response has started.
<para>
If <see langword="true" />, the <see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode" />,
<see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase" />, and <see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers" /> are now immutable, and
<see cref="M:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnStarting(System.Func{System.Object,System.Threading.Tasks.Task},System.Object)" /> should no longer be called.
</para>
Methods
void
OnStarting​(System.​Func<​object, System.​Threading.​Tasks.​Task> callback,
object state)
Registers a callback to be invoked just before the response starts.
<para>
This is the last chance to modify the <see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.Headers" />, <see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.StatusCode" />, or
<see cref="P:Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.ReasonPhrase" />.
</para>
callback
The callback to invoke when starting the response.
state
The state to pass into the callback.
void
OnCompleted​(System.​Func<​object, System.​Threading.​Tasks.​Task> callback,
object state)
Registers a callback to be invoked after a response has fully completed. This is
intended for resource cleanup.
callback
The callback to invoke after the response has completed.
state
The state to pass into the callback.