🧾 contenty

Package VersionHex Docs

A tiny Gleam library for parsing and inspecting HTTP Content-Type headers.

✨ Features

Installation

gleam add contenty
import contenty
import gleam/result
import gleam/dict
pub fn main() {
let content_type = contenty.parse("text/html; charset=utf-8")
contenty.mime(content_type)
// "text/html"
contenty.mime_type(content_type)
// "text"
contenty.mime_subtype(content_type)
// "html"
contenty.param(content_type, "charset")
// Ok("utf-8")
contenty.params(content_type)
// dict.from_list([#("charset", "utf-8")])
}

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

Development

gleam test # Run the tests