This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathIHttpResponseFeature.cs
59 lines (51 loc) · 2.32 KB
/
IHttpResponseFeature.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// 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
{
/// <summary>
/// Represents the fields and state of an HTTP response.
/// </summary>
public interface IHttpResponseFeature
{
/// <summary>
/// The status-code as defined in RFC 7230. The default value is 200.
/// </summary>
int StatusCode { get; set; }
/// <summary>
/// The reason-phrase as defined in RFC 7230. Note this field is no longer supported by HTTP/2.
/// </summary>
string ReasonPhrase { get; set; }
/// <summary>
/// The response headers to send. Headers with multiple values will be emitted as multiple headers.
/// </summary>
IHeaderDictionary Headers { get; set; }
/// <summary>
/// The <see cref="Stream"/> for writing the response body.
/// </summary>
Stream Body { get; set; }
/// <summary>
/// Indicates if the response has started. If true, the <see cref="StatusCode"/>,
/// <see cref="ReasonPhrase"/>, and <see cref="Headers"/> are now immutable, and
/// OnStarting should no longer be called.
/// </summary>
bool HasStarted { get; }
/// <summary>
/// Registers a callback to be invoked just before the response starts. This is the
/// last chance to modify the <see cref="Headers"/>, <see cref="StatusCode"/>, or
/// <see cref="ReasonPhrase"/>.
/// </summary>
/// <param name="callback">The callback to invoke when starting the response.</param>
/// <param name="state">The state to pass into the callback.</param>
void OnStarting(Func<object, Task> callback, object state);
/// <summary>
/// Registers a callback to be invoked after a response has fully completed. This is
/// intended for resource cleanup.
/// </summary>
/// <param name="callback">The callback to invoke after the response has completed.</param>
/// <param name="state">The state to pass into the callback.</param>
void OnCompleted(Func<object, Task> callback, object state);
}
}