[Modify] Add it

This commit is contained in:
sta 2020-05-19 19:39:53 +09:00
parent 6d78c62023
commit 1d16b4364d

View File

@ -782,6 +782,22 @@ namespace WebSocketSharp.Net
base.Add (name, checkValue (value));
}
private void checkAllowed (bool response)
{
if (_state == HttpHeaderType.Unspecified)
return;
var headerType = response
? HttpHeaderType.Response
: HttpHeaderType.Request;
if (headerType != _state) {
var msg = "This instance does not allow the header.";
throw new InvalidOperationException (msg);
}
}
private void checkAllowed (string name)
{
if (_state == HttpHeaderType.Unspecified)