Files
fn_registry/functions/browser/cdp_set_cookie.go
T
egutierrez 03568c88e3 chore: auto-commit (57 archivos)
- frontend/functions/core/format_datetime_short.md
- frontend/functions/core/format_datetime_short.test.ts
- frontend/functions/core/format_datetime_short.ts
- frontend/functions/core/format_duration.md
- frontend/functions/core/format_duration.test.ts
- frontend/functions/core/format_duration.ts
- frontend/functions/core/month_grid.md
- frontend/functions/core/month_grid.test.ts
- frontend/functions/core/month_grid.ts
- frontend/functions/core/string_hash_palette.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 03:41:58 +02:00

23 lines
728 B
Go

package browser
// CdpSetCookie establece una cookie en el browser via Network.setCookie.
// Util para autenticar tests e2e contra apps con sesion HttpOnly: hacer login
// HTTP en el test, capturar el Set-Cookie, y propagar al browser antes de navegar.
//
// name/value/domain son obligatorios. path por defecto "/". httpOnly true por
// defecto (replica HttpOnly de la app). secure y sameSite opcionales.
func CdpSetCookie(c *CDPConn, name, value, domain, path string, httpOnly bool) error {
if path == "" {
path = "/"
}
params := map[string]any{
"name": name,
"value": value,
"domain": domain,
"path": path,
"httpOnly": httpOnly,
}
_, err := c.sendCDP("Network.setCookie", params)
return err
}