···4455- HTML and JSON body functions now include `charset=utf-8` in the content-type
66 header.
77+- The `require_content_type` function now handles additional attributes
88+ correctly.
79810## v0.15.0 - 2024-05-12
911
+9-1
src/wisp.gleam
···11651165 next: fn() -> Response,
11661166) -> Response {
11671167 case list.key_find(request.headers, "content-type") {
11681168- Ok(content_type) if content_type == expected -> next()
11681168+ Ok(content_type) ->
11691169+ // This header may have further such as `; charset=utf-8`, so discard
11701170+ // that if it exists.
11711171+ case string.split_once(content_type, ";") {
11721172+ Ok(#(content_type, _)) if content_type == expected -> next()
11731173+ _ if content_type == expected -> next()
11741174+ _ -> unsupported_media_type([expected])
11751175+ }
11761176+11691177 _ -> unsupported_media_type([expected])
11701178 }
11711179}