Mutare.Phoenix.Download (mutare_phoenix v0.1.0)

Copy Markdown View Source

:download_disposition — flips the explicit :disposition option of Phoenix.Controller.send_download/3 between :attachment and :inline. A surviving mutant means no test pins whether the browser is told to save the file or display it — the type in the content-disposition header.

send_download(conn, {:file, path}, disposition: :attachment)   # → :inline
conn |> send_download({:binary, csv}, filename: "r.csv", disposition: :inline)
#                                                                     ↳ :attachment

Only an explicit literal atom is flipped: a send_download that relies on Phoenix's default (:attachment), or passes a variable, is left alone — as is send_download/2, which has no options at all. Matches the call written directly (Phoenix.Controller.send_download(conn, ...)), aliased, or bare-imported (send_download(conn, ...), the form use MyAppWeb, :controller produces).

The swap substitutes exactly the disposition atom, so Mutare.Transform.Overlap prunes the built-in :atom family's :mutare leaf at that range — which would only crash (Phoenix rejects any disposition other than :attachment / :inline), an uninformative kill.