function getCookies (headers) {
  webidl.argumentLengthCheck(arguments, 1, 'getCookies')

  brandChecks(headers)

  const cookie = headers.get('cookie')

  /** @type {Record<string, string>} */
  const out = {}

  if (!cookie) {
    return out
  }

  for (const piece of cookie.split(';')) {
    const [name, ...value] = piece.split('=')

    out[name.trim()] = value.join('=')
  }

  return out
}
@param {Headers} headers
@returns {Record<string, string>}