forked from lobo/lambda-zig
duplicate response string to be caller owned
This commit is contained in:
parent
194fdb8217
commit
ecbe134869
|
@ -365,7 +365,7 @@ fn lambda_request(allocator: std.mem.Allocator, request: []const u8) ![]u8 {
|
||||||
// Now we need to start the lambda framework, following a siimilar pattern
|
// Now we need to start the lambda framework, following a siimilar pattern
|
||||||
const lambda_thread = try test_run(allocator, handler); // We want our function under test to report leaks
|
const lambda_thread = try test_run(allocator, handler); // We want our function under test to report leaks
|
||||||
lambda_thread.join();
|
lambda_thread.join();
|
||||||
return server_request_aka_lambda_response;
|
return try allocator.dupe(u8, server_request_aka_lambda_response);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "basic request" {
|
test "basic request" {
|
||||||
|
@ -376,4 +376,5 @@ test "basic request" {
|
||||||
;
|
;
|
||||||
const lambda_response = try lambda_request(allocator, request);
|
const lambda_response = try lambda_request(allocator, request);
|
||||||
try std.testing.expectEqualStrings(lambda_response, request);
|
try std.testing.expectEqualStrings(lambda_response, request);
|
||||||
|
defer allocator.free(lambda_response);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user