Emil Lerch
1fe39007c5
All checks were successful
AWS-Zig Build / build-zig-amd64-host (push) Successful in 1m32s
29 lines
922 B
Zig
29 lines
922 B
Zig
//! This module provides base data structures for aws http requests
|
|
const std = @import("std");
|
|
const log = std.log.scoped(.aws_base);
|
|
pub const Request = struct {
|
|
path: []const u8 = "/",
|
|
query: []const u8 = "",
|
|
body: []const u8 = "",
|
|
method: []const u8 = "POST",
|
|
content_type: []const u8 = "application/json", // Can we get away with this?
|
|
headers: []const std.http.Header = &.{},
|
|
};
|
|
pub const Result = struct {
|
|
response_code: u16, // actually 3 digits can fit in u10
|
|
body: []const u8,
|
|
headers: []const std.http.Header,
|
|
allocator: std.mem.Allocator,
|
|
|
|
pub fn deinit(self: Result) void {
|
|
self.allocator.free(self.body);
|
|
for (self.headers) |h| {
|
|
self.allocator.free(h.name);
|
|
self.allocator.free(h.value);
|
|
}
|
|
self.allocator.free(self.headers);
|
|
//log.debug("http result deinit complete", .{});
|
|
return;
|
|
}
|
|
};
|