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
IHttpParserDelegate
just to have common methods between request and response (Headers, Body, etc). - create two interfaces
IHttpRequestParserDelegate
andIHttpResponseParserDelegate
that will inheritIHttpParserDelegate
with Request\Response specific methods. - two constructors for HttpParser.
- one receives
IHttpRequestParserDelegate
. - one receives
IHttpResponseParserDelegate
.
- one receives
- two member variables
- one
IHttpParserDelegate
variable - a flag as to whether the delegate is a
IHttpRequestParserDelegate
or aIHttpResponseParserDelegate
- one
- in the request/response-specific embedded actions, check the flag on and throw and exception if the value is unexpected