mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
doc fixup
This commit is contained in:
parent
7e2c3b6251
commit
6e206be5b6
1 changed files with 5 additions and 5 deletions
|
@ -196,12 +196,15 @@ const zap = @import("zap");
|
||||||
const a = std.heap.page_allocator;
|
const a = std.heap.page_allocator;
|
||||||
const token = "ABCDEFG";
|
const token = "ABCDEFG";
|
||||||
|
|
||||||
|
const HTTP_RESPONSE: []const u8 =
|
||||||
|
\\ <html><body>
|
||||||
|
\\ Hello from ZAP!!!
|
||||||
|
\\ </body></html>
|
||||||
|
|
||||||
// authenticated requests go here
|
// authenticated requests go here
|
||||||
fn endpoint_http_get(e: *zap.SimpleEndpoint, r: zap.SimpleRequest) void {
|
fn endpoint_http_get(e: *zap.SimpleEndpoint, r: zap.SimpleRequest) void {
|
||||||
_ = e;
|
_ = e;
|
||||||
r.sendBody(HTTP_RESPONSE) catch return;
|
r.sendBody(HTTP_RESPONSE) catch return;
|
||||||
received_response = HTTP_RESPONSE;
|
|
||||||
zap.fio_stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// just for fun, we also catch the unauthorized callback
|
// 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;
|
_ = e;
|
||||||
r.setStatus(.unauthorized);
|
r.setStatus(.unauthorized);
|
||||||
r.sendBody("UNAUTHORIZED ACCESS") catch return;
|
r.sendBody("UNAUTHORIZED ACCESS") catch return;
|
||||||
std.debug.print("\nunauthorized\n", .{});
|
|
||||||
received_response = "UNAUTHORIZED";
|
|
||||||
zap.fio_stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue