Created
June 12, 2012 20:56
-
-
Save loudej/2920089 to your computer and use it in GitHub Desktop.
Unify Request and Response representation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Owin | |
{ | |
public delegate void AppDelegate( | |
IDictionary<string, object> env, | |
ResultDelegate result, | |
Action<Exception> fault); | |
public delegate void ResultDelegate( | |
string status, | |
IDictionary<string, string[]> headers, | |
BodyDelegate body); | |
public delegate void BodyDelegate( | |
Func<ArraySegment<byte>, Action, bool> write, | |
Action<Exception> end, | |
CancellationToken cancellationToken); | |
public delegate Task<Tuple<string /* status */, IDictionary<String, string[]> /* headers */, BodyDelegate /* body */>> | |
AppTaskDelegate(IDictionary<string, object> env); | |
public interface IAppBuilder | |
{ | |
IAppBuilder Use<TApp>(Func<TApp, TApp> middleware); | |
TApp Build<TApp>(Action<IAppBuilder> fork); | |
IAppBuilder AddAdapters<TApp1, TApp2>(Func<TApp1, TApp2> adapter1, Func<TApp2, TApp1> adapter2); | |
IDictionary<string, object> Context { get; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Owin | |
{ | |
public delegate void AppDelegate( | |
IDictionary<string, object> env, | |
IDictionary<string, string[]> headers, | |
BodyDelegate body, | |
ResultDelegate result, | |
Action<Exception> fault); | |
public delegate void ResultDelegate( | |
string status, | |
IDictionary<string, string[]> headers, | |
BodyDelegate body, | |
IDictionary<string, object> properties); | |
public delegate void BodyDelegate( | |
Func<ArraySegment<byte>, Action, bool> write, | |
Action<Exception> end, | |
CancellationToken cancellationToken); | |
public delegate Task<Tuple<string /* status */, IDictionary<String, string[]> /* headers */, BodyDelegate /* body */, IDictionary<string, object> /*properties*/>> | |
AppTaskDelegate(IDictionary<string, object> env); | |
public interface IAppBuilder | |
{ | |
IAppBuilder Use<TApp>(Func<TApp, TApp> middleware); | |
TApp Build<TApp>(Action<IAppBuilder> fork); | |
IAppBuilder AddAdapters<TApp1, TApp2>(Func<TApp1, TApp2> adapter1, Func<TApp2, TApp1> adapter2); | |
IDictionary<string, object> Context { get; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Owin | |
{ | |
public struct CallParameters | |
{ | |
public IDictionary<string, object> Environment; | |
public IDictionary<string, string[]> RequestHeaders; | |
public BodyDelegate RequestBody; | |
} | |
public struct ResultParameters | |
{ | |
public string StatusCode; | |
public IDictionary<string, string[]> ResponseHeaders; | |
public BodyDelegate ResponseBody; | |
public IDictionary<string, object> ResponseProperties; | |
} | |
public delegate void AppDelegate(CallParameters call, Action<ResultParameters> result, Action<Exception> fault); | |
public delegate Task<ResultParameters> AppTaskDelegate(CallParameters call); | |
public delegate void BodyDelegate( | |
Func<ArraySegment<byte>, Action, bool> write, | |
Action<Exception> end, | |
CancellationToken cancel); | |
public interface IAppBuilder | |
{ | |
IAppBuilder Use<TApp>(Func<TApp, TApp> middleware); | |
TApp Build<TApp>(Action<IAppBuilder> fork); | |
IAppBuilder AddAdapters<TApp1, TApp2>(Func<TApp1, TApp2> adapter1, Func<TApp2, TApp1> adapter2); | |
IDictionary<string, object> Properties { get; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Owin | |
{ | |
public delegate void AppDelegate(IDictionary<string,object> env, Action<IDictionary<string,object>> result, Action<Exception> fault); | |
public delegate Task<IDictionary<string,object>> AppTaskDelegate(IDictionary<string,object> env); | |
public delegate void BodyDelegate( | |
Func<ArraySegment<byte>, Action, bool> write, | |
Action<Exception> end, | |
CancellationToken cancel); | |
public interface IAppBuilder | |
{ | |
IAppBuilder Use<TApp>(Func<TApp, TApp> middleware); | |
TApp Build<TApp>(Action<IAppBuilder> fork); | |
IAppBuilder AddAdapters<TApp1, TApp2>(Func<TApp1, TApp2> adapter1, Func<TApp2, TApp1> adapter2); | |
IDictionary<string, object> Properties { get; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment