public void AddExtraHeader(string header, object value) { if (value != null && !RawHeaders.ContainsKey(header)) { RawHeaders.Add(header, value); } }
/// <summary> /// Adds a single header or updates it if it already exists /// </summary> /// <param name="headerName">The name of the header</param> /// <param name="headerValue">The value for the header</param> public void SetHeaderValue(string headerName, string headerValue) { if (!RawHeaders.ContainsKey(headerName)) { RawHeaders.Add(headerName, new List <string> { headerValue }); } else { RawHeaders[headerName] = new List <string> { headerValue } }; ParseHeader(headerName, headerValue); }
/// <summary> /// Returns the value(s) of the header, <c>null</c> will be returned when the /// header does not exist /// </summary> /// <param name="headerName">The name of the header</param> public string HeaderValue(string headerName) { return(RawHeaders.ContainsKey(headerName) ? string.Join(Environment.NewLine, RawHeaders[headerName]) : null); }