replaceOrAdd(name:value:)
Add a header name/value pair to the block, replacing any previous values for the same header name that are already in the block.
mutating func replaceOrAdd(name: Name, value: String)
Parameters
This is a supplemental method to add
that essentially combines remove
and add
in a single function. It can be used to ensure that a header block is in a well-defined form without having to check whether the value was previously there. Like add
, this method performs case-insensitive comparisons of the header field names.