remove method
Removes a specific value for a header name.
Some headers have system supplied values which cannot be removed.
For all other headers and values, the value
is converted to a string
in the same way as for add, then that string value is removed from the
current values of name
.
If there are no remaining values for name
, the header is no longer
considered present.
Implementation
@override
void remove(String name, Object value) {
_checkMutable();
name = _validateField(name);
value = _validateValue(value);
List<String>? values = _headers[name];
if (values != null) {
values.remove(_valueToString(value));
if (values.isEmpty) {
_headers.remove(name);
_originalHeaderNames?.remove(name);
}
}
if (name == HttpHeaders.transferEncodingHeader && value == "chunked") {
_chunkedTransferEncoding = false;
}
}