Allow passing params by application/x-www-form-urlencoded
This commit is contained in:
parent
a15baaf2e7
commit
861c31c3ad
2 changed files with 5 additions and 4 deletions
|
@ -103,10 +103,11 @@ fn parseBody(comptime T: type, content_type: BaseContentType, reader: anytype, a
|
|||
|
||||
return try util.deepClone(alloc, body);
|
||||
},
|
||||
else => {
|
||||
std.log.debug("{}", .{content_type});
|
||||
return error.UnsupportedMediaType;
|
||||
.url_encoded => return query_utils.parseQuery(alloc, T, buf) catch |err| switch (err) {
|
||||
error.NoQuery => error.NoBody,
|
||||
else => err,
|
||||
},
|
||||
else => return error.UnsupportedMediaType,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ pub fn parseQuery(alloc: std.mem.Allocator, comptime T: type, query: []const u8)
|
|||
} else std.log.debug("unknown param {s}", .{pair.key});
|
||||
}
|
||||
|
||||
return (try parse(alloc, T, "", "", fields)).?;
|
||||
return (try parse(alloc, T, "", "", fields)) orelse error.NoQuery;
|
||||
}
|
||||
|
||||
fn decodeString(alloc: std.mem.Allocator, val: []const u8) ![]const u8 {
|
||||
|
|
Loading…
Reference in a new issue