Instance Method
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: HTTPHeaders.Name, value: String)
Parameters
nameThe header field name. For maximum compatibility this should be an ASCII string. For future-proofing with HTTP/2 lowercase header names are strongly
valueThe header field value to add for the given name.
Discussion
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.