URSA.Web.Http.HeaderCollection.Add C# (CSharp) Method

Add() public method

Adds a new header.
If the header already exists, method will merge new value and parameters with the existing ones.
public Add ( string name, string value ) : Header
name string Name of the header to be added.
value string Value of the header to be added.
return Header
        public Header Add(string name, string value)
        {
            return Add(Http.Header.Parse(String.Format("{0}:{1}", name, value)));
        }

Same methods

HeaderCollection::Add ( Header header ) : Header

Usage Example

コード例 #1
0
        public void it_should_serialize_the_headers_to_its_string_representation()
        {
            HeaderCollection headers = new HeaderCollection();
            headers.Add(new Header("Header1", new[] { new HeaderValue("Value1", new HeaderParameter("Parameter1", "ParameterValue1")) }));
            headers.Add(new Header("Header2", new[] { new HeaderValue("Value2", new HeaderParameter("Parameter2", "ParameterValue2")) }));

            string expected = String.Format("{0}\r\n{1}\r\n\r\n", headers["Header1"], headers["Header2"]);
            headers.ToString().Should().Be(expected);
        }
All Usage Examples Of URSA.Web.Http.HeaderCollection::Add