1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 23:24:09 +00:00

fix: docserver: server wasm with correct mimetype

This commit is contained in:
Louis Pearson 2024-04-23 16:13:07 -06:00
parent 49d629ba55
commit 3e4c29409e
2 changed files with 10 additions and 0 deletions

View file

@ -247,6 +247,7 @@ pub fn build(b: *std.Build) !void {
const docserver_run_step = b.step("run-docserver", "run the docserver");
const docserver_run = b.addRunArtifact(docserver_exe);
docserver_run.addPrefixedDirectoryArg("--docs=", docs_obj.getEmittedBinDirectory());
docserver_run_step.dependOn(&docserver_run.step);
docserver_run_step.dependOn(docserver_step);

View file

@ -26,6 +26,15 @@ pub fn main() !void {
}
}
const ext = "wasm";
var buf: [0xF]u8 = undefined;
@memcpy(buf[0..ext.len], ext);
const mimetype = "application/wasm";
const fio_mimetype = zap.fio.fiobj_str_new(mimetype[0..], mimetype.len);
zap.fio.http_mimetype_register(buf[0..ext.len], ext.len, fio_mimetype);
var listener = zap.HttpListener.init(.{
.port = port,
.on_request = on_request,