1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-21 15:44:10 +00:00
This commit is contained in:
winger 2024-03-30 23:11:25 +08:00
parent 6804d0f685
commit dc4a07e4a5
7 changed files with 10 additions and 11 deletions

View file

@ -11,7 +11,7 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
var http_client: std.http.Client = .{ .allocator = a }; var http_client: std.http.Client = .{ .allocator = a };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(a,.{ var result = try http_client.fetch(a, .{
.method = .GET, .method = .GET,
.location = .{ .location = .{
.uri = uri, .uri = uri,

View file

@ -11,7 +11,7 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
var http_client: std.http.Client = .{ .allocator = a }; var http_client: std.http.Client = .{ .allocator = a };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(a,.{ var result = try http_client.fetch(a, .{
.method = .GET, .method = .GET,
.location = .{ .location = .{
.uri = uri, .uri = uri,

View file

@ -2,4 +2,3 @@
.name = "facil.io", .name = "facil.io",
.version = "0.0.12", .version = "0.0.12",
} }

View file

@ -146,7 +146,7 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8, auth: ?ClientAuthReqHeader
var http_client: std.http.Client = .{ .allocator = a }; var http_client: std.http.Client = .{ .allocator = a };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(a,.{ var result = try http_client.fetch(a, .{
.location = .{ .location = .{
.uri = uri, .uri = uri,
}, },
@ -157,7 +157,7 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8, auth: ?ClientAuthReqHeader
// might have to do with connection pooling and connections being in // might have to do with connection pooling and connections being in
// a different state when all data has been read?!? // a different state when all data has been read?!?
{ {
if(result.body)|body|{ if (result.body) |body| {
std.debug.print("RESPONSE:\n{s}\n", .{body[0..]}); std.debug.print("RESPONSE:\n{s}\n", .{body[0..]});
} }
} }

View file

@ -10,10 +10,10 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
var http_client: std.http.Client = .{ .allocator = a }; var http_client: std.http.Client = .{ .allocator = a };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(a,.{ var result = try http_client.fetch(a, .{
.method = .GET, .method = .GET,
.location = .{ .location = .{
.uri = uri, .uri = uri,
}, },
.headers = h, .headers = h,
}); });

View file

@ -15,7 +15,7 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
var http_client: std.http.Client = .{ .allocator = a }; var http_client: std.http.Client = .{ .allocator = a };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(a,.{ var result = try http_client.fetch(a, .{
.method = .GET, .method = .GET,
.location = .{ .location = .{
.uri = uri, .uri = uri,
@ -24,9 +24,9 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
}); });
defer result.deinit(); defer result.deinit();
if(result.body)|body|{ if (result.body) |body| {
read_len = body.len; read_len = body.len;
std.mem.copyForwards(u8,&buffer,body); std.mem.copyForwards(u8, &buffer, body);
} }
zap.stop(); zap.stop();
} }

View file

@ -160,7 +160,7 @@ fn sendToDiscordPart(allocator: std.mem.Allocator, url: []const u8, message_json
var http_client: std.http.Client = .{ .allocator = allocator }; var http_client: std.http.Client = .{ .allocator = allocator };
defer http_client.deinit(); defer http_client.deinit();
var result = try http_client.fetch(allocator,.{ var result = try http_client.fetch(allocator, .{
.method = .POST, .method = .POST,
.location = .{ .location = .{
.uri = uri, .uri = uri,