๐Ÿชถ wispie

Package Version Hex Docs

A tiny Gleam library for rendering ๐Ÿงš wisp HTTP responses into readable text snapshots. Designed for use with ๐Ÿฆโ€โฌ› birdie snapshot testing, but also handy for debugging and logging.

โœจ Features

๐Ÿงฉ Installation

gleam add wispie@1

๐Ÿš€ Usage

import gleam/http/response
import wisp
import wispie
import birdie

pub fn json_response_snapshot__test() {
  let response_body =
    "
    {
      \"id\": \"123\",
      \"name\": \"John Doe\"
    }
    "

  let response = wisp.json_response(response_body, 201)

  response
  |> wispie.response_to_string
  |> birdie.snap("json_response")
}

produces a clean snapshot like

201
content-type: application/json

{
  "id": "123",
  "name": "John Doe"
}

Further documentation can be found at https://hexdocs.pm/wispie.

๐Ÿง‘โ€๐Ÿ’ป Development

gleam test  # Run the tests

๐Ÿงฐ Related

โœจ Search Document