public void RemoveHeader(string name) { if (string.IsNullOrEmpty(name) || RestrictedRequestHeaders.IsHeaderRestricted(name)) { return; } httpRequestMessage.Headers.Remove(name); }
public void AddHeader(string name, string value) { if (string.IsNullOrEmpty(name) || RestrictedRequestHeaders.IsHeaderRestricted(name)) { return; } httpRequestMessage.Headers.Add(name, value); }
public void AddHeader(string name, string value) { if (string.IsNullOrEmpty(name) || RestrictedRequestHeaders.IsHeaderRestricted(name)) { return; } if (WebHeaderCollection.IsRestricted(name)) { // restricted header cannot be set by us in the collection SetFrameworkRestrictedHeader(name, value); return; } httpWebRequest.Headers.Add(name, value); }
public void RemoveHeader(string name) { if (string.IsNullOrEmpty(name) || RestrictedRequestHeaders.IsHeaderRestricted(name)) { return; } if (WebHeaderCollection.IsRestricted(name)) { // restricted header cannot be removed directly // Workaround by Adding restricted header with null value SetFrameworkRestrictedHeader(name, null); return; } httpWebRequest.Headers.Remove(name); }