DocShell.Web.Response (DocShell v0.3.0)

Copy Markdown View Source

Sends an immutable cached JSON representation with HTTP validators.

Both the plug and controller use this response path so HEAD, conditional requests, and method handling agree. It performs no authorization: the host pipeline or DocShell plug gate must run first, including for 304 responses. Cache-Control and Vary remain host choices; this module preserves those headers and does not enable shared caching of protected documentation.

Summary

Functions

Serves a named artifact for GET or HEAD from the selected cache.

Sends an error response, omitting its body for HEAD requests.

Functions

send(conn, artifact, cache \\ Cache)

@spec send(Plug.Conn.t(), term(), atom()) :: Plug.Conn.t()

Serves a named artifact for GET or HEAD from the selected cache.

send_error(conn, status, body)

@spec send_error(Plug.Conn.t(), non_neg_integer(), String.t()) :: Plug.Conn.t()

Sends an error response, omitting its body for HEAD requests.