Created
November 30, 2010 16:59
-
-
Save panesofglass/721976 to your computer and use it in GitHub Desktop.
.NET Web Abstractions
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
// Func<IRequest, IResponse> | |
public interface IApplication { | |
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 { | |
string Method {get;} | |
string Uri {get;} | |
IDictionary<string, IEnumerable<string>> Headers {get;} | |
// Set custom, app-specific settings here. | |
IDictionary<string, object> Items {get;} | |
// Assume the request input is a System.IO.Stream. | |
IAsyncResult BeginReadInput(byte[] buffer, int offset, int count, AsyncCallback callback, object state); | |
int EndReadInput(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;} // "200 OK" | |
IDictionary<string, IEnumerable<string>> Headers {get;} | |
//IEnumerable Body {get;} | |
IEnumerable GetBody(); | |
} |
@serialseb brought up a great question: Is IMiddleware
necessary? Not sure given the interfaces above. How would you chain apps together?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should Header values be a simple
IEnumerable
instead ofIEnumerable<string>
?