Mutare.Plug.Cookie (mutare_plug v0.1.0)

Copy Markdown View Source

:resp_cookie — removes response-cookie mutations, flips explicit :same_site cookie policy values, and drops explicit :max_age options. A survivor means no test depends on this code setting/deleting the response cookie, on the cookie's SameSite policy, or on its persistence.

put_resp_cookie(conn, "sid", token)                    # → conn
delete_resp_cookie(conn, "sid")                        # → conn
put_resp_cookie(conn, "sid", token, same_site: "Lax")  # → "Strict" / "None"
put_resp_cookie(conn, "sid", token, max_age: ttl)      # → put_resp_cookie(conn, "sid", token)

Dropping max_age: turns a persistent cookie into a session cookie — an option-presence mutation the built-in literal families cannot produce (they mutate the duration's value, not the entry). It applies only to put_resp_cookie/4; delete_resp_cookie/3 forces max_age: 0 regardless of the option, so a drop there would be a no-op mutant.

Matches Plug.Conn.put_resp_cookie/3,4 and Plug.Conn.delete_resp_cookie/2,3 written directly, aliased, or bare-imported. Boolean-valued cookie options such as :secure, :http_only, :sign, and :encrypt are left to Mutare's built-in boolean mutators (dropping one is equivalent to flipping it to its default).