mirror of
https://github.com/zigzap/zap.git
synced 2025-10-21 15:44:10 +00:00
Update to new zig master api changes
This commit is contained in:
parent
c5d86376f8
commit
79fb534e80
5 changed files with 10 additions and 10 deletions
|
@ -11,11 +11,11 @@ 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 req = try http_client.request(.GET, uri, h, .{});
|
var req = try http_client.open(.GET, uri, h, .{});
|
||||||
defer req.deinit();
|
defer req.deinit();
|
||||||
|
|
||||||
try req.headers.append("cookie", "ZIG_ZAP=awesome");
|
try req.headers.append("cookie", "ZIG_ZAP=awesome");
|
||||||
try req.start(.{});
|
try req.send(.{});
|
||||||
try req.wait();
|
try req.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,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 req = try http_client.request(.GET, uri, h, .{});
|
var req = try http_client.open(.GET, uri, h, .{});
|
||||||
defer req.deinit();
|
defer req.deinit();
|
||||||
|
|
||||||
try req.start(.{});
|
try req.send(.{});
|
||||||
try req.wait();
|
try req.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ fn get_tag_annotation(allocator: std.mem.Allocator, tagname: []const u8) ![]cons
|
||||||
tagname,
|
tagname,
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = try std.ChildProcess.exec(.{
|
const result = try std.ChildProcess.run(.{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.argv = &args,
|
.argv = &args,
|
||||||
});
|
});
|
||||||
|
@ -161,13 +161,13 @@ fn sendToDiscordPart(allocator: std.mem.Allocator, url: []const u8, message_json
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
// request
|
// request
|
||||||
var req = try http_client.request(.POST, uri, h, .{});
|
var req = try http_client.open(.POST, uri, h, .{});
|
||||||
defer req.deinit();
|
defer req.deinit();
|
||||||
|
|
||||||
req.transfer_encoding = .chunked;
|
req.transfer_encoding = .chunked;
|
||||||
|
|
||||||
// connect, send request
|
// connect, send request
|
||||||
try req.start(.{});
|
try req.send(.{});
|
||||||
|
|
||||||
// send POST payload
|
// send POST payload
|
||||||
try req.writer().writeAll(message_json);
|
try req.writer().writeAll(message_json);
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub const usage_pkg =
|
||||||
;
|
;
|
||||||
|
|
||||||
pub fn gitLatestTag(gpa: Allocator, pkg_dir: []const u8) ![]const u8 {
|
pub fn gitLatestTag(gpa: Allocator, pkg_dir: []const u8) ![]const u8 {
|
||||||
const result = try std.ChildProcess.exec(.{
|
const result = try std.ChildProcess.run(.{
|
||||||
.allocator = gpa,
|
.allocator = gpa,
|
||||||
.argv = &.{
|
.argv = &.{
|
||||||
"git",
|
"git",
|
||||||
|
@ -97,7 +97,7 @@ pub fn gitLatestTag(gpa: Allocator, pkg_dir: []const u8) ![]const u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gitFileList(gpa: Allocator, pkg_dir: []const u8) ![]const u8 {
|
pub fn gitFileList(gpa: Allocator, pkg_dir: []const u8) ![]const u8 {
|
||||||
const result = try std.ChildProcess.exec(.{
|
const result = try std.ChildProcess.run(.{
|
||||||
.allocator = gpa,
|
.allocator = gpa,
|
||||||
.argv = &.{
|
.argv = &.{
|
||||||
"git",
|
"git",
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub fn main() !void {
|
||||||
res.transfer_encoding = .{ .content_length = server_body.len };
|
res.transfer_encoding = .{ .content_length = server_body.len };
|
||||||
try res.headers.append("content-type", "text/plain");
|
try res.headers.append("content-type", "text/plain");
|
||||||
try res.headers.append("connection", "close");
|
try res.headers.append("connection", "close");
|
||||||
try res.do();
|
try res.send();
|
||||||
|
|
||||||
var buf: [128]u8 = undefined;
|
var buf: [128]u8 = undefined;
|
||||||
_ = try res.readAll(&buf);
|
_ = try res.readAll(&buf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue