Skip to content

Release v0.7.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 21 Apr 18:29

ZAP Release v0.7.0

Updates

Update to Zig 0.12

With the help of our awesome contributers, we have a new release:

  • zap is now officially based on Zig 0.12.0!
  • tests have been updated to use the latest std.http client
  • @desttinghim added getHeaderCommon to zap.Request
  • @leroycep improved error return traces in zap.Request.sendError()
  • @dasimmet and @dweiller fixed the use of @fieldParentPtr to the new style
  • @xflow-systems improved the write function of websockets

Users of sendError(): the API has changed! The doc comment has been updated. The new way of using it is:

r.sendError(err, if (@errorReturnTrace()) |t| t.* else null, 505);

The new version outputs much nicer error traces.

Note: there will likely be a zig-master branch in the future that gets updated with breaking changes of Zig master. For sanity reasons, it will not be called zig-0.13.0 but zig-master. I'll update the README accordingly then.

Note 2: I merged PRs and fixed the tests while waiting for my plane to board, then finished on the plane. If I might have rushed it and oopsied something up, I'll apologize and follow up with a bugfix release.

One open issue is using openssl on macOS, especially with openssl in custom locations, like homebrew-installed versions. If anyone wants to look into that: PRs are welcome 😊!

Many thanks again to everyone who helped out!

Using it

To use in your own projects, put this dependency into your build.zig.zon:

        // zap v0.7.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.7.0.tar.gz",
            .hash = "1220a1cb1822ea77083045d246db5d7a6f07a8ddafa69c98dee367560f9ce667fd8d",
        }

Here is a complete build.zig.zon example:

.{
    .name = "My example project",
    .version = "0.0.1",

    .dependencies = .{
        // zap v0.7.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.7.0.tar.gz",
            .hash = "1220a1cb1822ea77083045d246db5d7a6f07a8ddafa69c98dee367560f9ce667fd8d",
        },
    },
    .paths = .{
        "",
    },
}

Then, in your build.zig's build function, add the following before exe.install():

    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
    });
    exe.addModule("zap", zap.module("zap"));
    exe.linkLibrary(zap.artifact("facil.io"));