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

Commit 74d50d0

Browse files
committed
Remove sync helpers
1 parent dd676ed commit 74d50d0

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

src/Microsoft.AspNet.Http.Abstractions/HttpResponse.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.IO;
6+
using System.Threading.Tasks;
67

78
namespace Microsoft.AspNet.Http
89
{
@@ -24,9 +25,9 @@ public abstract class HttpResponse
2425

2526
public abstract bool HasStarted { get; }
2627

27-
public abstract void OnResponseStarting(Action<object> callback, object state);
28+
public abstract void OnResponseStarting(Func<object, Task> callback, object state);
2829

29-
public abstract void OnResponseCompleted(Action<object> callback, object state);
30+
public abstract void OnResponseCompleted(Func<object, Task> callback, object state);
3031

3132
public virtual void Redirect(string location)
3233
{

src/Microsoft.AspNet.Http.Features/Authentication/ChallengeContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ namespace Microsoft.AspNet.Http.Features.Authentication
88
{
99
public class ChallengeContext
1010
{
11+
public ChallengeContext(string authenticationScheme) : this(authenticationScheme, properties: null, behavior: ChallengeBehavior.Automatic)
12+
{
13+
}
14+
1115
public ChallengeContext(string authenticationScheme, IDictionary<string, string> properties, ChallengeBehavior behavior)
1216
{
1317
AuthenticationScheme = authenticationScheme;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Threading.Tasks;
78

89
namespace Microsoft.AspNet.Http.Features
910
{
@@ -14,7 +15,7 @@ public interface IHttpResponseFeature
1415
IDictionary<string, string[]> Headers { get; set; }
1516
Stream Body { get; set; }
1617
bool HasStarted { get; }
17-
void OnResponseStarting(Action<object> callback, object state);
18-
void OnResponseCompleted(Action<object> callback, object state);
18+
void OnResponseStarting(Func<object, Task> callback, object state);
19+
void OnResponseCompleted(Func<object, Task> callback, object state);
1920
}
2021
}

src/Microsoft.AspNet.Http/DefaultHttpResponse.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.IO;
6+
using System.Threading.Tasks;
67
using Microsoft.AspNet.FeatureModel;
78
using Microsoft.AspNet.Http.Features;
89
using Microsoft.AspNet.Http.Features.Internal;
@@ -94,12 +95,12 @@ public override bool HasStarted
9495
get { return HttpResponseFeature.HasStarted; }
9596
}
9697

97-
public override void OnResponseStarting(Action<object> callback, object state)
98+
public override void OnResponseStarting(Func<object, Task> callback, object state)
9899
{
99100
HttpResponseFeature.OnResponseStarting(callback, state);
100101
}
101102

102-
public override void OnResponseCompleted(Action<object> callback, object state)
103+
public override void OnResponseCompleted(Func<object, Task> callback, object state)
103104
{
104105
HttpResponseFeature.OnResponseCompleted(callback, state);
105106
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Threading.Tasks;
78

89
namespace Microsoft.AspNet.Http.Features.Internal
910
{
@@ -29,14 +30,14 @@ public bool HasStarted
2930
get { return false; }
3031
}
3132

32-
public void OnResponseStarting(Action<object> callback, object state)
33+
public void OnResponseStarting(Func<object, Task> callback, object state)
3334
{
34-
throw new NotSupportedException();
35+
throw new NotImplementedException();
3536
}
3637

37-
public void OnResponseCompleted(Action<object> callback, object state)
38+
public void OnResponseCompleted(Func<object, Task> callback, object state)
3839
{
39-
throw new NotSupportedException();
40+
throw new NotImplementedException();
4041
}
4142
}
4243
}

src/Microsoft.AspNet.Owin/OwinEnvironment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public OwinEnvironment(HttpContext context)
6161
{ OwinConstants.ResponseReasonPhrase, new FeatureMap<IHttpResponseFeature>(feature => feature.ReasonPhrase, (feature, value) => feature.ReasonPhrase = Convert.ToString(value)) },
6262
{ OwinConstants.ResponseHeaders, new FeatureMap<IHttpResponseFeature>(feature => feature.Headers, (feature, value) => feature.Headers = (IDictionary<string, string[]>)value) },
6363
{ OwinConstants.ResponseBody, new FeatureMap<IHttpResponseFeature>(feature => feature.Body, () => Stream.Null, (feature, value) => feature.Body = (Stream)value) },
64-
{ OwinConstants.CommonKeys.OnSendingHeaders, new FeatureMap<IHttpResponseFeature>(feature => new Action<Action<object>, object>(feature.OnResponseStarting)) },
64+
{ OwinConstants.CommonKeys.OnSendingHeaders, new FeatureMap<IHttpResponseFeature>(feature => new Action<Func<object, Task>, object>(feature.OnResponseStarting)) },
6565

6666
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap<IHttpConnectionFeature>(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
6767
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },

src/Microsoft.AspNet.Owin/OwinFeatureCollection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,17 @@ bool IHttpResponseFeature.HasStarted
147147
get { return _headersSent; }
148148
}
149149

150-
void IHttpResponseFeature.OnResponseStarting(Action<object> callback, object state)
150+
void IHttpResponseFeature.OnResponseStarting(Func<object, Task> callback, object state)
151151
{
152-
var register = Prop<Action<Action<object>, object>>(OwinConstants.CommonKeys.OnSendingHeaders);
152+
var register = Prop<Action<Func<object, Task>, object>>(OwinConstants.CommonKeys.OnSendingHeaders);
153153
if (register == null)
154154
{
155155
throw new NotSupportedException(OwinConstants.CommonKeys.OnSendingHeaders);
156156
}
157157
register(callback, state);
158158
}
159159

160-
void IHttpResponseFeature.OnResponseCompleted(Action<object> callback, object state)
160+
void IHttpResponseFeature.OnResponseCompleted(Func<object, Task> callback, object state)
161161
{
162162
throw new NotSupportedException();
163163
}

0 commit comments

Comments
 (0)