1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

doc fixup

This commit is contained in:
Rene Schallner 2023-04-16 23:45:23 +02:00
parent 7e2c3b6251
commit 6e206be5b6

View file

@ -196,12 +196,15 @@ const zap = @import("zap");
const a = std.heap.page_allocator;
const token = "ABCDEFG";
const HTTP_RESPONSE: []const u8 =
\\ <html><body>
\\ Hello from ZAP!!!
\\ </body></html>
// authenticated requests go here
fn endpoint_http_get(e: *zap.SimpleEndpoint, r: zap.SimpleRequest) void {
_ = e;
r.sendBody(HTTP_RESPONSE) catch return;
received_response = HTTP_RESPONSE;
zap.fio_stop();
}
// just for fun, we also catch the unauthorized callback
@ -209,9 +212,6 @@ fn endpoint_http_unauthorized(e: *zap.SimpleEndpoint, r: zap.SimpleRequest) void
_ = e;
r.setStatus(.unauthorized);
r.sendBody("UNAUTHORIZED ACCESS") catch return;
std.debug.print("\nunauthorized\n", .{});
received_response = "UNAUTHORIZED";
zap.fio_stop();
}