public void ToString_WithAndWithoutParameters_SerializedCorrectly() { NameValueWithParametersHeaderValue nameValue = new NameValueWithParametersHeaderValue("text", "token"); Assert.Equal("text=token", nameValue.ToString()); nameValue.Parameters.Add(new NameValueHeaderValue("param1", "value1")); nameValue.Parameters.Add(new NameValueHeaderValue("param2", "value2")); Assert.Equal("text=token; param1=value1; param2=value2", nameValue.ToString()); }
private static void SetDeflateNegotiationResponse(HttpContext context, WebSocketDeflateCompressionProvider deflateCompressionProvider) { NameValueWithParametersHeaderValue secWebSocketExtensionsHeaderValue = new NameValueWithParametersHeaderValue(WEBSOCKET_PERMESSAGE_DEFLATE_EXTENSION); if (deflateCompressionProvider.ClientNoContextTakeover) { secWebSocketExtensionsHeaderValue.Parameters.Add(new NameValueHeaderValue(WebSocketDeflateCompressionOptions.CLIENT_NO_CONTEXT_TAKEOVER_OPTION)); } if (deflateCompressionProvider.ServerNoContextTakeover) { secWebSocketExtensionsHeaderValue.Parameters.Add(new NameValueHeaderValue(WebSocketDeflateCompressionOptions.SERVER_NO_CONTEXT_TAKEOVER_OPTION)); } context.Response.Headers[HeaderNames.SecWebSocketExtensions] = secWebSocketExtensionsHeaderValue.ToString(); }