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

Added OnResponseCompleted to HttpResponse #196

Merged
merged 1 commit into from
Mar 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Microsoft.AspNet.Http.Core/DefaultHttpResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public override void OnSendingHeaders(Action<object> callback, object state)
HttpResponseFeature.OnSendingHeaders(callback, state);
}

public override void OnResponseCompleted(Action<object> callback, object state)
{
HttpResponseFeature.OnResponseCompleted(callback, state);
}

public override void Redirect(string location, bool permanent)
{
if (permanent)
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.AspNet.Http.Core/HttpResponseFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ public void OnSendingHeaders(Action<object> callback, object state)
{
throw new NotSupportedException();
}

public void OnResponseCompleted(Action<object> callback, object state)
{
throw new NotSupportedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public interface IHttpResponseFeature
Stream Body { get; set; }
bool HeadersSent { get; }
void OnSendingHeaders(Action<object> callback, object state);
void OnResponseCompleted(Action<object> callback, object state);
}
}
2 changes: 2 additions & 0 deletions src/Microsoft.AspNet.Http/HttpResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public abstract class HttpResponse

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

public abstract void OnResponseCompleted(Action<object> callback, object state);

public virtual void Redirect(string location)
{
Redirect(location, permanent: false);
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.AspNet.Owin/OwinFeatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ void IHttpResponseFeature.OnSendingHeaders(Action<object> callback, object state
register(callback, state);
}

void IHttpResponseFeature.OnResponseCompleted(Action<object> callback, object state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This?

void IHttpResponseFeature.OnSendingHeaders(Action<object> callback, object state)
{
var register = Prop<Action<Action<object>, object>>(OwinConstants.CommonKeys.OnSendingHeaders);
if (register == null)
{
throw new NotSupportedException(OwinConstants.CommonKeys.OnSendingHeaders);
}
register(callback, state);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, the code you pointed supports calling the server.OnSendingHeaders callback from ASP.NET 5, but can't inject server.OnSendingHeaders in the OWIN environment, which is what the OwinEnvironment class does.

Anyway, @Tratcher said they were only using community defined keys.

{
throw new NotSupportedException();
}

IPAddress IHttpConnectionFeature.RemoteIpAddress
{
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.RemoteIpAddress)); }
Expand Down