zynagent-first application framework

Back to the API reference

zyn.MediaType#

/// A syntactically valid HTTP media type from a Content-Type field.
pub const MediaType = struct {
    /// Returns whether the type and subtype match `expected` case-insensitively.
    /// Parameters on the received Content-Type do not affect the match.
    pub fn is(self: MediaType, comptime expected: []const u8) bool;

    /// Returns whether the subtype has the supplied structured syntax suffix.
    pub fn has_suffix(self: MediaType, comptime expected: []const u8) bool;

    /// Returns the original Content-Type field value.
    pub fn raw(self: MediaType) []const u8;
};