function addHeaderLine(headers, name, value) {
  let values // code below expects `values` to be an array of strings
  if (typeof value === 'function') {
    // Function values are evaluated towards the end of the response, before that we use a placeholder
    // string just to designate that the header exists. Useful when `Content-Type` is set with a function.
    values = [value.name]
  } else if (Array.isArray(value)) {
    values = value.map(String)
  } else {
    values = [String(value)]
  }

  const key = name.toLowerCase()
  if (key === 'set-cookie') {
    // Array header -- only Set-Cookie at the moment
    if (headers['set-cookie'] === undefined) {
      headers['set-cookie'] = values
    } else {
      headers['set-cookie'].push(...values)
    }
  } else if (noDuplicatesHeaders.has(key)) {
    if (headers[key] === undefined) {
      // Drop duplicates
      headers[key] = values[0]
    }
  } else {
    if (headers[key] !== undefined) {
      values = [headers[key], ...values]
    }

    const separator = key === 'cookie' ? '; ' : ', '
    headers[key] = values.join(separator)
  }
}
Set key/value data in accordance with Node's logic for folding duplicate headers.

The `value` param should be a function, string, or array of strings.

Node's docs and source:
https://nodejs.org/api/http.html#http_message_headers
https://github.com/nodejs/node/blob/908292cf1f551c614a733d858528ffb13fb3a524/lib/_http_incoming.js#L245

Header names are lower-cased.
Duplicates in raw headers are handled in the following ways, depending on the header name:
- Duplicates of field names listed in `noDuplicatesHeaders` (above) are discarded.
- `set-cookie` is always an array. Duplicates are added to the array.
- For duplicate `cookie` headers, the values are joined together with '; '.
- For all other headers, the values are joined together with ', '.

Node's implementation is larger because it highly optimizes for not having to call `toLowerCase()`.
We've opted to always call `toLowerCase` in exchange for a more concise function.

While Node has the luxury of knowing `value` is always a string, we do an extra step of coercion at the top.