fix query args (http_query is a decl, not a field)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3005e07cee
commit
535205e947
10
src/aws.zig
10
src/aws.zig
|
@ -410,7 +410,7 @@ fn buildQuery(allocator: *std.mem.Allocator, request: anytype) ![]const u8 {
|
|||
defer buffer.deinit();
|
||||
var has_begun = false;
|
||||
const Req = @TypeOf(request);
|
||||
if (std.meta.fieldIndex(Req, "http_query") == null)
|
||||
if (declaration(Req, "http_query") == null)
|
||||
return buffer.toOwnedSlice();
|
||||
const query_arguments = Req.http_query;
|
||||
inline for (@typeInfo(@TypeOf(query_arguments)).Struct.fields) |arg| {
|
||||
|
@ -428,6 +428,14 @@ fn buildQuery(allocator: *std.mem.Allocator, request: anytype) ![]const u8 {
|
|||
return buffer.toOwnedSlice();
|
||||
}
|
||||
|
||||
fn declaration(comptime T: type, name: []const u8) ?std.builtin.TypeInfo.Declaration {
|
||||
for (std.meta.declarations(T)) |decl| {
|
||||
if (std.mem.eql(u8, name, decl.name))
|
||||
return decl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
fn addQueryArg(key: []const u8, value: anytype, writer: anytype, start: bool) !void {
|
||||
if (start)
|
||||
_ = try writer.write("?")
|
||||
|
|
Loading…
Reference in New Issue
Block a user