httpmachine
httpmachine copied to clipboard
A mechanism to ensure that the parser will only parse requests or only parse responses
As described by @sergey-litvinov on #10:
- update
IHttpParserDelegatejust to have common methods between request and response (Headers, Body, etc). - create two interfaces
IHttpRequestParserDelegateandIHttpResponseParserDelegatethat will inheritIHttpParserDelegatewith Request\Response specific methods. - two constructors for HttpParser.
- one receives
IHttpRequestParserDelegate. - one receives
IHttpResponseParserDelegate.
- one receives
- two member variables
- one
IHttpParserDelegatevariable - a flag as to whether the delegate is a
IHttpRequestParserDelegateor aIHttpResponseParserDelegate
- one
- in the request/response-specific embedded actions, check the flag on and throw and exception if the value is unexpected