Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 3f98d1c

Browse files
committed
Added OnResponseCompleted to HttpResponse
1 parent fa18a8f commit 3f98d1c

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

src/Microsoft.AspNet.Http.Core/DefaultHttpResponse.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
using System.IO;
77
using System.Linq;
88
using System.Security.Claims;
9-
using System.Text;
10-
using System.Threading.Tasks;
11-
using Microsoft.AspNet.Http;
129
using Microsoft.AspNet.Http.Infrastructure;
1310
using Microsoft.AspNet.Http.Security;
1411
using Microsoft.AspNet.FeatureModel;
@@ -115,6 +112,11 @@ public override void OnSendingHeaders(Action<object> callback, object state)
115112
HttpResponseFeature.OnSendingHeaders(callback, state);
116113
}
117114

115+
public override void OnResponseCompleted(Action<object> callback, object state)
116+
{
117+
HttpResponseFeature.OnResponseCompleted(callback, state);
118+
}
119+
118120
public override void Redirect(string location, bool permanent)
119121
{
120122
if (permanent)

src/Microsoft.AspNet.Http.Core/HttpResponseFeature.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ public void OnSendingHeaders(Action<object> callback, object state)
3434
{
3535
throw new NotSupportedException();
3636
}
37+
38+
public void OnResponseCompleted(Action<object> callback, object state)
39+
{
40+
throw new NotSupportedException();
41+
}
3742
}
3843
}

src/Microsoft.AspNet.Http.Interfaces/IHttpResponseFeature.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ public interface IHttpResponseFeature
1515
Stream Body { get; set; }
1616
bool HeadersSent { get; }
1717
void OnSendingHeaders(Action<object> callback, object state);
18+
void OnResponseCompleted(Action<object> callback, object state);
1819
}
1920
}

src/Microsoft.AspNet.Http/HttpResponse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public abstract class HttpResponse
2727

2828
public abstract void OnSendingHeaders(Action<object> callback, object state);
2929

30+
public abstract void OnResponseCompleted(Action<object> callback, object state);
31+
3032
public virtual void Redirect(string location)
3133
{
3234
Redirect(location, permanent: false);

src/Microsoft.AspNet.Owin/OwinConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ internal static class CommonKeys
7070
public const string AppName = "host.AppName";
7171
public const string Capabilities = "server.Capabilities";
7272
public const string OnSendingHeaders = "server.OnSendingHeaders";
73+
public const string OnResponseCompleted = "server.OnResponseCompleted";
7374
public const string OnAppDisposing = "host.OnAppDisposing";
7475
public const string Scheme = "scheme";
7576
public const string Host = "host";

src/Microsoft.AspNet.Owin/OwinFeatureCollection.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ void IHttpResponseFeature.OnSendingHeaders(Action<object> callback, object state
155155
register(callback, state);
156156
}
157157

158+
void IHttpResponseFeature.OnResponseCompleted(Action<object> callback, object state)
159+
{
160+
var register = Prop<Action<Action<object>, object>>(OwinConstants.CommonKeys.OnResponseCompleted);
161+
if (register == null)
162+
{
163+
throw new NotSupportedException(OwinConstants.CommonKeys.OnResponseCompleted);
164+
}
165+
register(callback, state);
166+
}
167+
158168
IPAddress IHttpConnectionFeature.RemoteIpAddress
159169
{
160170
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.RemoteIpAddress)); }

0 commit comments

Comments
 (0)