srctree

Jeremy Hertel parent 5756fadd 17e8d1ce
add status code argument to sendJSON

src/verse.zig added: 3, removed: 2, total 1
@@ -190,7 +190,8 @@ pub fn sendError(vrs: *Verse, comptime code: std.http.Status) !void {
 
/// Takes a any object, that can be represented by json, converts it into a
/// json string, and sends to the client.
pub fn sendJSON(vrs: *Verse, json: anytype) !void {
pub fn sendJSON(vrs: *Verse, json: anytype, comptime code: std.http.Status) !void {
vrs.response.status = code;
try vrs.quickStart();
const data = std.json.stringifyAlloc(vrs.alloc, json, .{
.emit_null_optional_fields = false,