oaspec/util/http
Values
pub fn sort_response_entries(
entries: List(#(String, a)),
) -> List(#(String, a))
Sort response entries so that exact codes come before ranges, and ranges come before the default catch-all. This ensures correct pattern matching order in generated case expressions.
pub fn status_code_suffix(code: String) -> String
Shared HTTP status code utilities for code generation. Get a human-readable suffix for a given HTTP status code. Used to build anonymous type names like “ListPetsResponseOk”.
pub fn status_code_to_int(code: String) -> String
Convert a status code string to an integer string for use in ServerResponse. Range codes and “default” map to a representative status code.
pub fn status_code_to_int_pattern(code: String) -> String
Convert a status code string to a valid Gleam case pattern. Exact codes become integer literals, range codes become guard expressions, and “default” becomes “_” (catch-all).