lightspeed/transport/wisp_html

Wisp-style server-rendered initial HTML adapter.

Types

Initial HTTP render request context.

pub type HtmlRequest {
  HtmlRequest(
    session_id: String,
    route: String,
    csrf_token: String,
    origin: String,
  )
}

Constructors

  • HtmlRequest(
      session_id: String,
      route: String,
      csrf_token: String,
      origin: String,
    )

Minimal HTTP response shape emitted by the adapter.

pub type HtmlResponse {
  HtmlResponse(
    status: Int,
    headers: List(#(String, String)),
    body: String,
  )
}

Constructors

  • HtmlResponse(
      status: Int,
      headers: List(#(String, String)),
      body: String,
    )

Values

pub fn body(response: HtmlResponse) -> String

Access response body.

pub fn render_initial(
  request: HtmlRequest,
  rendered_html: String,
  websocket_path: String,
  auth_hook: contract.AuthHook,
) -> Result(HtmlResponse, contract.AdapterError)

Render initial HTML with adapter metadata markers.

pub fn status(response: HtmlResponse) -> Int

Access response status.

Search Document