MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / serialize_cookie_header

Function serialize_cookie_header

src/services/browser_cookie_utils.py:279–292  ·  view source on GitHub ↗
(raw_cookie: Any, default_url: str = DEFAULT_COOKIE_URL)

Source from the content-addressed store, hash-verified

277def _build_cookie_merge_key(cookie: Dict[str, Any], default_url: str) -> Optional[str]:
278 name = str(cookie.get("name") or "").strip()
279 if not name:
280 return None
281 domain = str(cookie.get("domain") or "").strip().lower()
282 url = str(cookie.get("url") or "").strip()
283 path = str(cookie.get("path") or "/").strip() or "/"
284 if not domain:
285 candidate_url = url or default_url
286 try:
287 parsed = urlparse(candidate_url)
288 domain = str(parsed.hostname or "").strip().lower()
289 except Exception:
290 domain = ""
291 return json.dumps([name, domain, path], ensure_ascii=True, separators=(",", ":"))
292
293
294def merge_browser_cookie_payloads(
295 base_cookie: Any,

Callers

nothing calls this directly

Tested by

no test coverage detected