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

Compare commits

...

5 commits

Author SHA1 Message Date
GitHub Action
66a7967aca Update README 2025-07-23 18:32:58 +00:00
renerocksai
e67b672977
fix zig version in README, bump zon version 2025-07-23 20:25:23 +02:00
renerocksai
dabd0637f9
endpoints, auth endpoints, middleware endpoints: eliminate need for empty stubs 2025-07-23 20:23:49 +02:00
renerocksai
baaa71d0e0
tests: fix non-overlapping ports during tests 2025-07-23 20:08:17 +02:00
renerocksai
6bdd5a41e4
exapmles/app/errors.zig: remove unnecessary empty stubs 2025-07-23 19:00:06 +02:00
16 changed files with 91 additions and 125 deletions

View file

@ -25,7 +25,7 @@ proved to be:
## FAQ:
- Q: **What version of Zig does Zap support?**
- Zap uses the latest stable zig release (0.14.0), so you don't have to keep
- Zap uses the latest stable zig release (0.14.1), so you don't have to keep
up with frequent breaking changes. It's an "LTS feature".
- Q: **Can Zap build with Zig's master branch?**
- See the `zig-master` branch. Please note that the zig-master branch is not
@ -266,7 +266,7 @@ code leaks memory.
## Getting started
Make sure you have **zig 0.14.0** installed. Fetch it from
Make sure you have **zig 0.14.1** installed. Fetch it from
[here](https://ziglang.org/download).
```shell
@ -279,7 +279,7 @@ $ # open http://localhost:3000 in your browser
## Using ⚡zap⚡ in your own projects
Make sure you have **the latest zig release (0.14.0)** installed. Fetch it from
Make sure you have **the latest zig release (0.14.1)** installed. Fetch it from
[here](https://ziglang.org/download).
If you don't have an existing zig project, create one like this:
@ -298,7 +298,7 @@ In your zig project folder (where `build.zig` is located), run:
<!-- INSERT_DEP_BEGIN -->
```
zig fetch --save "git+https://github.com/zigzap/zap#v0.10.4"
zig fetch --save "git+https://github.com/zigzap/zap#v0.10.5"
```
<!-- INSERT_DEP_END -->
@ -412,3 +412,4 @@ pub fn main() !void {

View file

@ -1,6 +1,6 @@
.{
.name = .zap,
.version = "0.10.4",
.version = "0.10.5",
.paths = .{
"build.zig",
"build.zig.zon",

View file

@ -14,7 +14,7 @@ const MyContext = struct {
db_connection: []const u8,
// we don't use this
pub fn unhandledRequest(_: *MyContext, _: Allocator, _: zap.Request) anyerror!void {}
// pub fn unhandledRequest(_: *MyContext, _: Allocator, _: zap.Request) anyerror!void {}
pub fn unhandledError(_: *MyContext, _: zap.Request, err: anyerror) void {
std.debug.print("\n\n\nUNHANDLED ERROR: {} !!! \n\n\n", .{err});
@ -46,14 +46,6 @@ const ErrorEndpoint = struct {
// -> error will be raised and dispatched to MyContext.unhandledError
return error.@"Oh-No!";
}
// empty stubs for all other request methods
pub fn post(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn put(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn delete(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn patch(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn options(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn head(_: *ErrorEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
};
const StopEndpoint = struct {
@ -69,12 +61,6 @@ const StopEndpoint = struct {
, .{context.*.db_connection});
zap.stop();
}
pub fn post(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn put(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn delete(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn patch(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
pub fn options(_: *StopEndpoint, _: Allocator, _: *MyContext, _: zap.Request) !void {}
};
pub fn main() !void {

View file

@ -13,11 +13,3 @@ pub fn get(_: *ErrorEndpoint, _: zap.Request) !void {
// --> this error will be shown in the browser, with a nice error trace
return error.@"Oh-no!";
}
// unused:
pub fn post(_: *ErrorEndpoint, _: zap.Request) !void {}
pub fn put(_: *ErrorEndpoint, _: zap.Request) !void {}
pub fn delete(_: *ErrorEndpoint, _: zap.Request) !void {}
pub fn patch(_: *ErrorEndpoint, _: zap.Request) !void {}
pub fn options(_: *ErrorEndpoint, _: zap.Request) !void {}
pub fn head(_: *ErrorEndpoint, _: zap.Request) !void {}

View file

@ -17,10 +17,3 @@ pub fn init(path: []const u8) StopEndpoint {
pub fn get(_: *StopEndpoint, _: zap.Request) !void {
zap.stop();
}
pub fn post(_: *StopEndpoint, _: zap.Request) !void {}
pub fn put(_: *StopEndpoint, _: zap.Request) !void {}
pub fn delete(_: *StopEndpoint, _: zap.Request) !void {}
pub fn patch(_: *StopEndpoint, _: zap.Request) !void {}
pub fn options(_: *StopEndpoint, _: zap.Request) !void {}
pub fn head(_: *StopEndpoint, _: zap.Request) !void {}

View file

@ -43,7 +43,8 @@ fn userIdFromPath(self: *UserWeb, path: []const u8) ?usize {
return null;
}
pub fn put(_: *UserWeb, _: zap.Request) !void {}
// not implemented
// pub fn put(_: *UserWeb, _: zap.Request) !void {}
pub fn get(self: *UserWeb, r: zap.Request) !void {
if (r.path) |path| {

View file

@ -31,14 +31,6 @@ const Endpoint = struct {
r.setStatus(.unauthorized);
r.sendBody("UNAUTHORIZED ACCESS") catch return;
}
// not implemented, don't care
pub fn post(_: *Endpoint, _: zap.Request) !void {}
pub fn put(_: *Endpoint, _: zap.Request) !void {}
pub fn delete(_: *Endpoint, _: zap.Request) !void {}
pub fn patch(_: *Endpoint, _: zap.Request) !void {}
pub fn options(_: *Endpoint, _: zap.Request) !void {}
pub fn head(_: *Endpoint, _: zap.Request) !void {}
};
pub fn main() !void {

View file

@ -152,13 +152,6 @@ const HtmlEndpoint = struct {
};
}
pub fn post(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn put(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn delete(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn patch(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn options(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn head(_: *HtmlEndpoint, _: zap.Request) !void {}
pub fn get(_: *HtmlEndpoint, r: zap.Request) !void {
var buf: [1024]u8 = undefined;
var userFound: bool = false;

View file

@ -5,7 +5,11 @@
//! Pass an instance of an Endpoint struct to zap.Endpoint.Listener.register()
//! function to register with the listener.
//!
//! **NOTE**: Endpoints must implement the following "interface":
//! **NOTE**: Endpoints can implement the following "interface":
//!
//! Any method handler that's not implemented will be handled automatically:
//! - zap will log it
//! - a response with status code 405 (method not allowed) is sent to the client
//!
//! ```zig
//! /// The http request path / slug of the endpoint
@ -13,6 +17,7 @@
//! error_strategy: zap.Endpoint.ErrorStrategy,
//!
//! /// Handlers by request method:
//! /// implement any of the following
//! pub fn get(_: *Self, _: zap.Request) !void {}
//! pub fn post(_: *Self, _: zap.Request) !void {}
//! pub fn put(_: *Self, _: zap.Request) !void {}
@ -44,13 +49,6 @@
//! pub fn get(_: *StopEndpoint, _: zap.Request) !void {
//! zap.stop();
//! }
//!
//! pub fn post(_: *StopEndpoint, _: zap.Request) !void {}
//! pub fn put(_: *StopEndpoint, _: zap.Request) !void {}
//! pub fn delete(_: *StopEndpoint, _: zap.Request) !void {}
//! pub fn patch(_: *StopEndpoint, _: zap.Request) !void {}
//! pub fn options(_: *StopEndpoint, _: zap.Request) !void {}
//! pub fn head(_: *StopEndpoint, _: zap.Request) !void {}
//! };
//! ```
@ -154,10 +152,25 @@ pub fn checkEndpointType(T: type) void {
@compileError("Expected return type of method `" ++ @typeName(T) ++ "." ++ method ++ "` to be !void, got: !" ++ @typeName(ret_info.error_union.payload));
}
} else {
@compileError(@typeName(T) ++ " has no method named `" ++ method ++ "`");
// it is ok not to implement a method handler
// pass
}
}
}
// This can be resolved at comptime so *perhaps it does affect optimiazation
pub fn callHandlerIfExist(comptime fn_name: []const u8, e: anytype, r: Request) anyerror!void {
const EndPointType = @TypeOf(e.*);
if (@hasDecl(EndPointType, fn_name)) {
return @field(EndPointType, fn_name)(e, r);
}
zap.log.debug(
"Unhandled `{s}` {s} request ({s} not implemented in {s})",
.{ r.method orelse "<unknown>", r.path orelse "", fn_name, @typeName(EndPointType) },
);
r.setStatus(.method_not_allowed);
try r.sendBody("405 - method not allowed\r\n");
return;
}
pub const Binder = struct {
pub const Interface = struct {
@ -189,13 +202,13 @@ pub const Binder = struct {
pub fn onRequest(self: *Bound, r: zap.Request) !void {
const ret = switch (r.methodAsEnum()) {
.GET => self.endpoint.*.get(r),
.POST => self.endpoint.*.post(r),
.PUT => self.endpoint.*.put(r),
.DELETE => self.endpoint.*.delete(r),
.PATCH => self.endpoint.*.patch(r),
.OPTIONS => self.endpoint.*.options(r),
.HEAD => self.endpoint.*.head(r),
.GET => callHandlerIfExist("get", self.endpoint, r),
.POST => callHandlerIfExist("post", self.endpoint, r),
.PUT => callHandlerIfExist("put", self.endpoint, r),
.DELETE => callHandlerIfExist("delete", self.endpoint, r),
.PATCH => callHandlerIfExist("patch", self.endpoint, r),
.OPTIONS => callHandlerIfExist("options", self.endpoint, r),
.HEAD => callHandlerIfExist("head", self.endpoint, r),
else => error.UnsupportedHtmlRequestMethod,
};
if (ret) {
@ -249,8 +262,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates GET requests using the Authenticator.
pub fn get(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.get(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("get", self.ep, r),
.Handled => {},
};
}
@ -258,8 +271,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates POST requests using the Authenticator.
pub fn post(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.post(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("post", self.ep, r),
.Handled => {},
};
}
@ -267,8 +280,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates PUT requests using the Authenticator.
pub fn put(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.put(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("put", self.ep, r),
.Handled => {},
};
}
@ -276,8 +289,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates DELETE requests using the Authenticator.
pub fn delete(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.delete(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("delete", self.ep, r),
.Handled => {},
};
}
@ -285,8 +298,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates PATCH requests using the Authenticator.
pub fn patch(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.patch(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("patch", self.ep, r),
.Handled => {},
};
}
@ -294,8 +307,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates OPTIONS requests using the Authenticator.
pub fn options(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.put(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("options", self.ep, r),
.Handled => {},
};
}
@ -303,8 +316,8 @@ pub fn Authenticating(EndpointType: type, Authenticator: type) type {
/// Authenticates HEAD requests using the Authenticator.
pub fn head(self: *AuthenticatingEndpoint, r: zap.Request) anyerror!void {
try switch (self.authenticator.authenticateRequest(&r)) {
.AuthFailed => return self.ep.*.unauthorized(r),
.AuthOK => self.ep.*.head(r),
.AuthFailed => callHandlerIfExist("unauthorized", self.ep, r),
.AuthOK => callHandlerIfExist("head", self.ep, r),
.Handled => {},
};
}

View file

@ -1,5 +1,6 @@
const std = @import("std");
const zap = @import("zap.zig");
const callHandlerIfExist = @import("endpoint.zig").callHandlerIfExist;
/// Your middleware components need to contain a handler.
///
@ -102,16 +103,16 @@ pub fn EndpointHandler(comptime HandlerType: anytype, comptime EndpointType: any
if (!self.options.checkPath or
std.mem.startsWith(u8, r.path orelse "", self.endpoint.path))
{
switch (r.methodAsEnum()) {
.GET => try self.endpoint.*.get(r),
.POST => try self.endpoint.*.post(r),
.PUT => try self.endpoint.*.put(r),
.DELETE => try self.endpoint.*.delete(r),
.PATCH => try self.endpoint.*.patch(r),
.OPTIONS => try self.endpoint.*.options(r),
.HEAD => try self.endpoint.*.head(r),
try switch (r.methodAsEnum()) {
.GET => callHandlerIfExist("get", self.endpoint, r),
.POST => callHandlerIfExist("post", self.endpoint, r),
.PUT => callHandlerIfExist("put", self.endpoint, r),
.DELETE => callHandlerIfExist("delete", self.endpoint, r),
.PATCH => callHandlerIfExist("patch", self.endpoint, r),
.OPTIONS => callHandlerIfExist("options", self.endpoint, r),
.HEAD => callHandlerIfExist("head", self.endpoint, r),
else => {},
}
};
}
// if the request was handled by the endpoint, we may break the chain here

View file

@ -165,12 +165,6 @@ pub const Endpoint = struct {
std.time.sleep(1 * std.time.ns_per_s);
zap.stop();
}
pub fn post(_: *Endpoint, _: zap.Request) !void {}
pub fn put(_: *Endpoint, _: zap.Request) !void {}
pub fn delete(_: *Endpoint, _: zap.Request) !void {}
pub fn patch(_: *Endpoint, _: zap.Request) !void {}
pub fn options(_: *Endpoint, _: zap.Request) !void {}
pub fn head(_: *Endpoint, _: zap.Request) !void {}
};
//
// end of http client code
@ -184,7 +178,7 @@ test "BearerAuthSingle authenticateRequest OK" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3001,
.on_request = null,
.log = false,
.max_clients = 10,
@ -211,7 +205,7 @@ test "BearerAuthSingle authenticateRequest OK" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Bearer, .token = token });
const thread = try makeRequestThread(a, "http://127.0.0.1:3001/test", .{ .auth = .Bearer, .token = token });
defer thread.join();
// start worker threads
@ -231,7 +225,7 @@ test "BearerAuthSingle authenticateRequest test-unauthorized" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3002,
.on_request = null,
.log = false,
.max_clients = 10,
@ -264,7 +258,7 @@ test "BearerAuthSingle authenticateRequest test-unauthorized" {
try listener.listen();
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Bearer, .token = "invalid" });
const thread = try makeRequestThread(a, "http://127.0.0.1:3002/test", .{ .auth = .Bearer, .token = "invalid" });
defer thread.join();
// start worker threads
@ -284,7 +278,7 @@ test "BearerAuthMulti authenticateRequest OK" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3003,
.on_request = null,
.log = false,
.max_clients = 10,
@ -311,7 +305,7 @@ test "BearerAuthMulti authenticateRequest OK" {
try listener.listen();
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Bearer, .token = token });
const thread = try makeRequestThread(a, "http://127.0.0.1:3003/test", .{ .auth = .Bearer, .token = token });
defer thread.join();
// start worker threads
@ -331,7 +325,7 @@ test "BearerAuthMulti authenticateRequest test-unauthorized" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3004,
.on_request = null,
.log = false,
.max_clients = 10,
@ -358,7 +352,7 @@ test "BearerAuthMulti authenticateRequest test-unauthorized" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Bearer, .token = "invalid" });
const thread = try makeRequestThread(a, "http://127.0.0.1:3004/test", .{ .auth = .Bearer, .token = "invalid" });
defer thread.join();
// start worker threads
@ -378,7 +372,7 @@ test "BasicAuth Token68 authenticateRequest" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3005,
.on_request = null,
.log = false,
.max_clients = 10,
@ -410,7 +404,7 @@ test "BasicAuth Token68 authenticateRequest" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Basic, .token = token });
const thread = try makeRequestThread(a, "http://127.0.0.1:3005/test", .{ .auth = .Basic, .token = token });
defer thread.join();
// start worker threads
@ -430,7 +424,7 @@ test "BasicAuth Token68 authenticateRequest test-unauthorized" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3006,
.on_request = null,
.log = false,
.max_clients = 10,
@ -462,7 +456,7 @@ test "BasicAuth Token68 authenticateRequest test-unauthorized" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Basic, .token = "invalid" });
const thread = try makeRequestThread(a, "http://127.0.0.1:3006/test", .{ .auth = .Basic, .token = "invalid" });
defer thread.join();
// start worker threads
@ -481,7 +475,7 @@ test "BasicAuth UserPass authenticateRequest" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3007,
.on_request = null,
.log = false,
.max_clients = 10,
@ -524,7 +518,7 @@ test "BasicAuth UserPass authenticateRequest" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Basic, .token = encoded });
const thread = try makeRequestThread(a, "http://127.0.0.1:3007/test", .{ .auth = .Basic, .token = encoded });
defer thread.join();
// start worker threads
@ -543,7 +537,7 @@ test "BasicAuth UserPass authenticateRequest test-unauthorized" {
var listener = zap.Endpoint.Listener.init(
a,
.{
.port = 3000,
.port = 3008,
.on_request = null,
.log = false,
.max_clients = 10,
@ -589,7 +583,7 @@ test "BasicAuth UserPass authenticateRequest test-unauthorized" {
listener.listen() catch {};
const thread = try makeRequestThread(a, "http://127.0.0.1:3000/test", .{ .auth = .Basic, .token = "invalid" });
const thread = try makeRequestThread(a, "http://127.0.0.1:3008/test", .{ .auth = .Basic, .token = "invalid" });
defer thread.join();
// start worker threads

View file

@ -65,7 +65,7 @@ test "http parameters" {
// setup listener
var listener = zap.HttpListener.init(
.{
.port = 3001,
.port = 3010,
.on_request = Handler.on_request,
.log = false,
.max_clients = 10,
@ -74,7 +74,7 @@ test "http parameters" {
);
try listener.listen();
const thread = try makeRequestThread(allocator, "http://127.0.0.1:3001/?one=1&two=2&string=hello+world&float=6.28&bool=true");
const thread = try makeRequestThread(allocator, "http://127.0.0.1:3010/?one=1&two=2&string=hello+world&float=6.28&bool=true");
defer thread.join();
zap.start(.{
.threads = 1,

View file

@ -110,7 +110,7 @@ test "recv file" {
var listener = zap.HttpListener.init(
.{
.port = 3003,
.port = 3020,
.on_request = on_request,
.log = false,
.max_clients = 10,
@ -119,7 +119,7 @@ test "recv file" {
);
try listener.listen();
const t1 = try std.Thread.spawn(.{}, makeRequest, .{ allocator, "http://127.0.0.1:3003" });
const t1 = try std.Thread.spawn(.{}, makeRequest, .{ allocator, "http://127.0.0.1:3020" });
defer t1.join();
zap.start(.{

View file

@ -108,7 +108,7 @@ test "recv file" {
var listener = zap.HttpListener.init(
.{
.port = 3003,
.port = 3030,
.on_request = on_request,
.log = false,
.max_clients = 10,
@ -117,7 +117,7 @@ test "recv file" {
);
try listener.listen();
const t1 = try std.Thread.spawn(.{}, makeRequest, .{ allocator, "http://127.0.0.1:3003" });
const t1 = try std.Thread.spawn(.{}, makeRequest, .{ allocator, "http://127.0.0.1:3030" });
defer t1.join();
zap.start(.{

View file

@ -42,7 +42,7 @@ test "send file" {
// setup listener
var listener = zap.HttpListener.init(
.{
.port = 3002,
.port = 3040,
.on_request = on_request,
.log = false,
.max_clients = 10,
@ -51,7 +51,7 @@ test "send file" {
);
try listener.listen();
const thread = try makeRequestThread(allocator, "http://127.0.0.1:3002/?file=src/tests/testfile.txt");
const thread = try makeRequestThread(allocator, "http://127.0.0.1:3040/?file=src/tests/testfile.txt");
defer thread.join();
zap.start(.{
.threads = 1,