mirror of
https://github.com/zigzap/zap.git
synced 2025-10-21 07:34:08 +00:00
Compare commits
No commits in common. "a385bea1edecc4f4ab9116150bc9dca9f44f9595" and "66a7967acafe3d70ee660ca6bfa60cd72478607f" have entirely different histories.
a385bea1ed
...
66a7967aca
4 changed files with 4 additions and 28 deletions
|
@ -298,7 +298,7 @@ In your zig project folder (where `build.zig` is located), run:
|
||||||
|
|
||||||
<!-- INSERT_DEP_BEGIN -->
|
<!-- INSERT_DEP_BEGIN -->
|
||||||
```
|
```
|
||||||
zig fetch --save "git+https://github.com/zigzap/zap#v0.10.6"
|
zig fetch --save "git+https://github.com/zigzap/zap#v0.10.5"
|
||||||
```
|
```
|
||||||
<!-- INSERT_DEP_END -->
|
<!-- INSERT_DEP_END -->
|
||||||
|
|
||||||
|
@ -413,4 +413,3 @@ pub fn main() !void {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.{
|
.{
|
||||||
.name = .zap,
|
.name = .zap,
|
||||||
.version = "0.10.6",
|
.version = "0.10.5",
|
||||||
.paths = .{
|
.paths = .{
|
||||||
"build.zig",
|
"build.zig",
|
||||||
"build.zig.zon",
|
"build.zig.zon",
|
||||||
|
|
|
@ -132,17 +132,11 @@ fn parseBinfilesFrom(a: Allocator, o: fio.FIOBJ) !HttpParam {
|
||||||
|
|
||||||
var mimetype: []const u8 = undefined;
|
var mimetype: []const u8 = undefined;
|
||||||
if (fio.fiobj_hash_haskey(o, key_type) == 1) {
|
if (fio.fiobj_hash_haskey(o, key_type) == 1) {
|
||||||
const mt_fiobj = fio.fiobj_hash_get(o, key_type);
|
const mt = fio.fiobj_obj2cstr(fio.fiobj_hash_get(o, key_type));
|
||||||
// for some reason, mimetype can be an array
|
|
||||||
if (fio.fiobj_type_is(mt_fiobj, fio.FIOBJ_T_STRING) == 1) {
|
|
||||||
const mt = fio.fiobj_obj2cstr(mt_fiobj);
|
|
||||||
mimetype = mt.data[0..mt.len];
|
mimetype = mt.data[0..mt.len];
|
||||||
} else {
|
} else {
|
||||||
mimetype = &"application/octet-stream".*;
|
mimetype = &"application/octet-stream".*;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
mimetype = &"application/octet-stream".*;
|
|
||||||
}
|
|
||||||
|
|
||||||
var data_slice: ?[]const u8 = null;
|
var data_slice: ?[]const u8 = null;
|
||||||
|
|
||||||
|
|
17
src/util.zig
17
src/util.zig
|
@ -17,23 +17,6 @@ pub fn fio2str(o: fio.FIOBJ) ?[]const u8 {
|
||||||
return x.data[0..x.len];
|
return x.data[0..x.len];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fiobj_type_as_string(o: zap.fio.FIOBJ) []const u8 {
|
|
||||||
const value_type = switch (zap.fio.fiobj_type(o)) {
|
|
||||||
zap.fio.FIOBJ_T_NULL => "null",
|
|
||||||
zap.fio.FIOBJ_T_TRUE => "true",
|
|
||||||
zap.fio.FIOBJ_T_FALSE => "false",
|
|
||||||
zap.fio.FIOBJ_T_NUMBER => "number",
|
|
||||||
zap.fio.FIOBJ_T_FLOAT => "float",
|
|
||||||
zap.fio.FIOBJ_T_STRING => "string",
|
|
||||||
zap.fio.FIOBJ_T_ARRAY => "array",
|
|
||||||
zap.fio.FIOBJ_T_HASH => "hash",
|
|
||||||
zap.fio.FIOBJ_T_DATA => "data",
|
|
||||||
zap.fio.FIOBJ_T_UNKNOWN => "unknown",
|
|
||||||
else => "unreachable",
|
|
||||||
};
|
|
||||||
return value_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used internally: convert a FIO object into its string representation.
|
/// Used internally: convert a FIO object into its string representation.
|
||||||
/// This always allocates, so choose your allocator wisely.
|
/// This always allocates, so choose your allocator wisely.
|
||||||
/// Let's never use that
|
/// Let's never use that
|
||||||
|
|
Loading…
Add table
Reference in a new issue