1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 23:24:09 +00:00

update tests + fix options auth handler

This commit is contained in:
OsakiTsukiko 2024-11-16 22:02:28 +02:00
parent 789d876ba7
commit 0076a533c2
4 changed files with 11 additions and 1 deletions

View file

@ -237,6 +237,7 @@ pub fn main() !void {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create authenticator // create authenticator

View file

@ -228,7 +228,7 @@ pub fn Authenticating(comptime Authenticator: type) type {
return; return;
} }
}, },
.AuthOK => authEp.ep.settings.put.?(authEp.ep, r), .AuthOK => authEp.ep.settings.options.?(authEp.ep, r),
.Handled => {}, .Handled => {},
} }
} }

View file

@ -191,6 +191,7 @@ test "BearerAuthSingle authenticateRequest OK" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create authenticator // create authenticator
@ -244,6 +245,7 @@ test "BearerAuthSingle authenticateRequest test-unauthorized" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
const Set = std.StringHashMap(void); const Set = std.StringHashMap(void);
@ -301,6 +303,7 @@ test "BearerAuthMulti authenticateRequest OK" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create authenticator // create authenticator
@ -352,6 +355,7 @@ test "BearerAuthMulti authenticateRequest test-unauthorized" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create authenticator // create authenticator
@ -403,6 +407,7 @@ test "BasicAuth Token68 authenticateRequest" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create a set of Token68 entries // create a set of Token68 entries
const Set = std.StringHashMap(void); const Set = std.StringHashMap(void);
@ -459,6 +464,7 @@ test "BasicAuth Token68 authenticateRequest test-unauthorized" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create a set of Token68 entries // create a set of Token68 entries
const Set = std.StringHashMap(void); const Set = std.StringHashMap(void);
@ -514,6 +520,7 @@ test "BasicAuth UserPass authenticateRequest" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create a set of User -> Pass entries // create a set of User -> Pass entries
@ -580,6 +587,7 @@ test "BasicAuth UserPass authenticateRequest test-unauthorized" {
.path = "/test", .path = "/test",
.get = endpoint_http_get, .get = endpoint_http_get,
.unauthorized = endpoint_http_unauthorized, .unauthorized = endpoint_http_unauthorized,
.unset = Endpoint.dummy_handler,
}); });
// create a set of User -> Pass entries // create a set of User -> Pass entries

View file

@ -33,6 +33,7 @@ pub const Tls = @import("tls.zig");
/// .ep = zap.Endpoint.init(.{ /// .ep = zap.Endpoint.init(.{
/// .path = path, /// .path = path,
/// .get = get, /// .get = get,
/// .unset = Endpoint.dummy_handler,
/// }), /// }),
/// }; /// };
/// } /// }