-
-
Save bvanderveen/722135 to your computer and use it in GitHub Desktop.
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
public interface IApplication { | |
// either may throw exception | |
IAsyncResult BeginInvoke(IRequest request, AsyncCallback callback, object state); | |
IResponse EndInvoke(IAsyncResult result); | |
} |
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
public interface IRequest { | |
// a bucket into which the host, app, middleware, or whomever can throw things. | |
IDictionary<string, object> Items { get; } | |
string Method { get; } | |
string Uri { get; } | |
IDictionary<string, IEnumerable<string>> Headers { get; } | |
// application calls pair until EndReadBody returns 0. either may throw exception. | |
IAsyncResult BeginReadBody(byte[] buffer, int offset, int count, AsyncCallback callback, object state); | |
int EndReadBody(IAsyncResult result); | |
} |
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
public interface IResponse { | |
string Status { get; } // e.g., "200 OK" | |
IDictionary<string, IEnumerable<string>> Headers {get;} | |
// can contain string, byte[], ArraySegment<byte>, FileInfo, | |
// Task<string>, Task<byte[]>, Task<ArraySegment<byte>>, Task<FileInfo> | |
// | |
// exceptions: | |
// - GetBody() could throw | |
// - GetBody().GetEnumerator() could throw | |
// - GetBody().GetEnumerator().MoveNext() could throw | |
// - GetBody().GetEnumerator().Current could throw | |
IEnumerable GetBody(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment