Release v0.5.1
Pre-releaseZAP Release v0.5.1
Updates
Request.methodAsEnum() and Windows build error message
This is a small update of recent PRs. Thanks for the great contributions!
See the changelog below for individual contributions.
zap.Request.methodAsEnum()
returns HTTP method as enum or .UNKNOWN- the reason the method is not an enum by default is to avoid the
string comparisons on every request when we might not need them
- the reason the method is not an enum by default is to avoid the
- build attempts on Windows now produce a meaningful error message
zap.Request
now supportsgetParamSlice()
andgetParamSlices()
which return optional string slices of the raw query string.- PRO: no allocation
- CON: no decoding: "hello+zap" will not be decoded into "hello zap"
- if you need decoding, you can still use
getParamStr()
.
I updated the docs and zig-0.12.0 branch, too, as with all recent and future releases.
Changelog in alphabetical order:
Froxcey (4):
Use std.http.Method for Request.method
Use custom method enum
Provide Windows error message
Use debug.err and exit 1 for windows fail message
Joe Liotta (1):
fixed unneeded optional unwrap in hello_json
Rene Schallner (8):
Update README.md to point out even more prominently the zig master situation
Merge pull request #72 from Chiissu/master
Merge pull request #75 from Chiissu/windows-errmsg
access raw query params w/o allocator, close #40
cosmetics
Merge pull request #79 from joeypas/master
fix workflow to detect failing builds of individual samples
in http.methodToEnum use std.meta.stringToEnum
performance: revert r.method enum back to ?[]const u8
(new http.Method enum is available via r.methodAsEnum())
use methodAsEnum() in Endpoint, and in json example
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.5.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.5.1.tar.gz",
.hash = "1220d4802fb09d4e99c0e7265f90d6f3cfdc3e5e31c1b05f0924ee2dd26d9d6dbbf4",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.5.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.5.1.tar.gz",
.hash = "1220d4802fb09d4e99c0e7265f90d6f3cfdc3e5e31c1b05f0924ee2dd26d9d6dbbf4",
}
}
}
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"));