add tests for config based on header and path
This commit is contained in:
parent
08141a7bed
commit
327ebae4f2
|
@ -6,3 +6,4 @@
|
||||||
|
|
||||||
/c = zig-out/lib/libfaas-proxy-sample-lib-in-c.so
|
/c = zig-out/lib/libfaas-proxy-sample-lib-in-c.so
|
||||||
/ = zig-out/lib/libfaas-proxy-sample-lib.so
|
/ = zig-out/lib/libfaas-proxy-sample-lib.so
|
||||||
|
Host: iam.aws.lerch.org / = zig-out/lib/libfaas-proxy-sample-lib.so
|
||||||
|
|
13
src/main.zig
13
src/main.zig
|
@ -462,6 +462,13 @@ fn testGet(comptime path: []const u8) !void {
|
||||||
"\r\n");
|
"\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn testHostGet(comptime host: []const u8, comptime path: []const u8) !void {
|
||||||
|
try testRequest("GET " ++ path ++ " HTTP/1.1\r\n" ++
|
||||||
|
"Host: " ++ host ++ "\r\n" ++
|
||||||
|
"Accept: */*\r\n" ++
|
||||||
|
"\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
// To run nested container tests, either, call `refAllDecls` which will
|
// To run nested container tests, either, call `refAllDecls` which will
|
||||||
// reference all declarations located in the given argument.
|
// reference all declarations located in the given argument.
|
||||||
|
@ -480,3 +487,9 @@ test "root path get" {
|
||||||
try std.testing.expectEqual(@as(usize, 2), test_resp_buf_len);
|
try std.testing.expectEqual(@as(usize, 2), test_resp_buf_len);
|
||||||
try std.testing.expectEqualStrings(" 1", test_resp_buf[0..test_resp_buf_len]);
|
try std.testing.expectEqualStrings(" 1", test_resp_buf[0..test_resp_buf_len]);
|
||||||
}
|
}
|
||||||
|
test "root path, alternative host get" {
|
||||||
|
std.testing.log_level = .debug;
|
||||||
|
log.debug("", .{});
|
||||||
|
try testHostGet("iam.aws.lerch.org", "/");
|
||||||
|
try std.testing.expectEqualStrings("iam response", test_resp_buf[0..test_resp_buf_len]);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user