Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type text/event-stream #144

Open
jmcudd opened this issue Dec 13, 2024 · 0 comments
Open

Content-Type text/event-stream #144

jmcudd opened this issue Dec 13, 2024 · 0 comments

Comments

@jmcudd
Copy link

jmcudd commented Dec 13, 2024

Certainly there are more content types than this. I'm trying to implement Server Sent Events and there doesn't seem to be a way to override this and set the content type to text/event-stream. I'm new to Zig and Zap, so I'm probably just overlooking something.

zap/src/request.zig

Lines 371 to 379 in 675c65b

pub fn setContentType(self: *const Self, c: ContentType) HttpError!void {
const s = switch (c) {
.TEXT => "text/plain",
.JSON => "application/json",
else => "text/html",
};
zap.debug("setting content-type to {s}\n", .{s});
return self.setHeader("content-type", s);
}

I also tried setting the headers req.setHeader("Content-Type", "text/event-stream") but this doesn't change the content type. Also when the accept field is set to text/event-stream in the request, the router doesn't trigger the corresponding route handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant