mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 07:04:08 +00:00
0.15.1-fix accept example
This commit is contained in:
parent
e5c5e7d3cf
commit
4efcf18999
2 changed files with 4 additions and 4 deletions
|
@ -19,7 +19,7 @@ fn on_request_verbose(r: zap.Request) !void {
|
||||||
|
|
||||||
const content_type: zap.ContentType = content_type: {
|
const content_type: zap.ContentType = content_type: {
|
||||||
var accept_list = r.parseAcceptHeaders(accept_allocator) catch break :content_type .HTML;
|
var accept_list = r.parseAcceptHeaders(accept_allocator) catch break :content_type .HTML;
|
||||||
defer accept_list.deinit();
|
defer accept_list.deinit(accept_allocator);
|
||||||
|
|
||||||
for (accept_list.items) |accept| {
|
for (accept_list.items) |accept| {
|
||||||
break :content_type accept.toContentType() orelse continue;
|
break :content_type accept.toContentType() orelse continue;
|
||||||
|
@ -72,7 +72,7 @@ fn on_request_verbose(r: zap.Request) !void {
|
||||||
\\ <body>
|
\\ <body>
|
||||||
\\ <h1>Hello from ZAP!!!</h1>
|
\\ <h1>Hello from ZAP!!!</h1>
|
||||||
\\ </body>
|
\\ </body>
|
||||||
\\</html>
|
\\</html>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ pub fn setHeader(self: *const Request, name: []const u8, value: []const u8) Http
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn headersToOwnedList(self: *const Request, a: Allocator) !HttpParamStrKVList {
|
pub fn headersToOwnedList(self: *const Request, a: Allocator) !HttpParamStrKVList {
|
||||||
var headers = std.ArrayList(HttpParamStrKV).init(a);
|
var headers = std.ArrayList(HttpParamStrKV).empty;
|
||||||
var context: CallbackContext_StrKV = .{
|
var context: CallbackContext_StrKV = .{
|
||||||
.params = &headers,
|
.params = &headers,
|
||||||
.allocator = a,
|
.allocator = a,
|
||||||
|
@ -543,7 +543,7 @@ pub fn headersToOwnedList(self: *const Request, a: Allocator) !HttpParamStrKVLis
|
||||||
if (howmany != headers.items.len) {
|
if (howmany != headers.items.len) {
|
||||||
return error.HttpIterHeaders;
|
return error.HttpIterHeaders;
|
||||||
}
|
}
|
||||||
return .{ .items = try headers.toOwnedSlice(), .allocator = a };
|
return .{ .items = try headers.toOwnedSlice(a), .allocator = a };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set status by numeric value.
|
/// Set status by numeric value.
|
||||||
|
|
Loading…
Add table
Reference in a new issue