add headers to returned response
This commit is contained in:
parent
4bca7eba8f
commit
da9eae4876
|
@ -84,10 +84,16 @@ const HttpRequest = struct {
|
||||||
const HttpResult = struct {
|
const HttpResult = struct {
|
||||||
response_code: u16, // actually 3 digits can fit in u10
|
response_code: u16, // actually 3 digits can fit in u10
|
||||||
body: []const u8,
|
body: []const u8,
|
||||||
|
headers: []Header,
|
||||||
allocator: *std.mem.Allocator,
|
allocator: *std.mem.Allocator,
|
||||||
|
|
||||||
pub fn deinit(self: HttpResult) void {
|
pub fn deinit(self: HttpResult) void {
|
||||||
self.allocator.free(self.body);
|
self.allocator.free(self.body);
|
||||||
|
for (self.headers) |h| {
|
||||||
|
self.allocator.free(h.name);
|
||||||
|
self.allocator.free(h.value);
|
||||||
|
}
|
||||||
|
self.allocator.free(self.headers);
|
||||||
httplog.debug("http result deinit complete", .{});
|
httplog.debug("http result deinit complete", .{});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -458,6 +464,7 @@ pub const AwsHttp = struct {
|
||||||
const rc = HttpResult{
|
const rc = HttpResult{
|
||||||
.response_code = context.response_code.?,
|
.response_code = context.response_code.?,
|
||||||
.body = final_body,
|
.body = final_body,
|
||||||
|
.headers = context.headers.?.toOwnedSlice(),
|
||||||
.allocator = self.allocator,
|
.allocator = self.allocator,
|
||||||
};
|
};
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user