zyn.Payload#
/// Request-scoped input supplied to an application-owned payload parser.
pub const Payload = struct {
arena: std.mem.Allocator,
body: []const u8,
/// The parsed inbound Content-Type field, or `null` when absent.
content_type: ?MediaType,
headers: RequestHeaders,
/// One typed payload validation issue.
pub const Detail = struct {
path: []const u8,
reason: []const u8,
expected: ?[]const u8 = null,
actual: ?[]const u8 = null,
};
/// Adds one validation issue. The framework rejects the parsed value after
/// the parser returns when any issues were added.
pub fn invalidate(
self: *Payload,
detail: Detail,
) error{OutOfMemory}!void;
};