Add XmlSerializer, add Response.type, tweak HTMLTemplate to redirect some calls to its Content (DocumentFragment)

This commit is contained in:
Karl Seguin
2025-12-02 00:08:45 +08:00
parent af8970bbb9
commit e807c9b6be
14 changed files with 295 additions and 26 deletions

View File

@@ -40,10 +40,11 @@ _response: *Response,
_resolver: js.PersistentPromiseResolver,
pub const Input = Request.Input;
pub const RequestInit = Request.Options;
// @ZIGDOM just enough to get campfire demo working
pub fn init(input: Input, page: *Page) !js.Promise {
const request = try Request.init(input, null, page);
pub fn init(input: Input, options: ?RequestInit, page: *Page) !js.Promise {
const request = try Request.init(input, options, page);
const fetch = try page.arena.create(Fetch);
fetch.* = .{
@@ -60,7 +61,6 @@ pub fn init(input: Input, page: *Page) !js.Promise {
if (comptime IS_DEBUG) {
log.debug(.http, "fetch", .{ .url = request._url });
}
std.debug.print("fetch: {s}\n", .{request._url});
try http_client.request(.{
.ctx = fetch,
@@ -100,7 +100,6 @@ fn httpDataCallback(transfer: *Http.Transfer, data: []const u8) !void {
fn httpDoneCallback(ctx: *anyopaque) !void {
const self: *Fetch = @ptrCast(@alignCast(ctx));
self._response._body = self._buf.items;
std.debug.print("fetch-resolve: {s}\n", .{self._url});
return self._resolver.resolve(self._response);
}