Skip to content

Commit

Permalink
fix: docserver: server wasm with correct mimetype
Browse files Browse the repository at this point in the history
  • Loading branch information
desttinghim committed Apr 23, 2024
1 parent 49d629b commit 3e4c294
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions tools/docserver.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3e4c294

Please sign in to comment.