diff --git a/proxy.ini b/proxy.ini index fd9eede..57586a8 100644 --- a/proxy.ini +++ b/proxy.ini @@ -6,3 +6,4 @@ /c = zig-out/lib/libfaas-proxy-sample-lib-in-c.so / = zig-out/lib/libfaas-proxy-sample-lib.so +Host: iam.aws.lerch.org / = zig-out/lib/libfaas-proxy-sample-lib.so diff --git a/src/main.zig b/src/main.zig index fae57f6..f34aee2 100644 --- a/src/main.zig +++ b/src/main.zig @@ -462,6 +462,13 @@ fn testGet(comptime path: []const u8) !void { "\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 { // To run nested container tests, either, call `refAllDecls` which will // 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.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]); +}