implement cookie for Response
This commit is contained in:
parent
64ace43684
commit
464d8a2516
1 changed files with 4 additions and 2 deletions
|
@ -3,7 +3,7 @@ const tuple = std.meta.Tuple;
|
||||||
const allocator = std.heap.page_allocator;
|
const allocator = std.heap.page_allocator;
|
||||||
const eql = std.mem.eql;
|
const eql = std.mem.eql;
|
||||||
const stat = @import("./status.zig");
|
const stat = @import("./status.zig");
|
||||||
const rc = @import("./res_cookie.zig");
|
const rescookie = @import("./res_cookie.zig");
|
||||||
|
|
||||||
/// Route is a touple that consists of the path and the function that shall handle it.
|
/// Route is a touple that consists of the path and the function that shall handle it.
|
||||||
/// e.g. `const rt = Route{"/home", home};`
|
/// e.g. `const rt = Route{"/home", home};`
|
||||||
|
@ -105,7 +105,7 @@ pub const Response = struct {
|
||||||
/// Response eaders sent by the server
|
/// Response eaders sent by the server
|
||||||
headers: []const Header = &[_]Header{.{ .key = "Content-Type", .value = "text/html; charset=utf-8" }},
|
headers: []const Header = &[_]Header{.{ .key = "Content-Type", .value = "text/html; charset=utf-8" }},
|
||||||
/// Cookies to be sent
|
/// Cookies to be sent
|
||||||
cookies: []const rc.Cookie = &[_]rc.Cookie{.{ .name = "", .value = "" }},
|
cookies: []const Cookie = &[_]Cookie{.{ .name = "", .value = "" }},
|
||||||
/// Response body sent by the server
|
/// Response body sent by the server
|
||||||
body: []const u8 = "",
|
body: []const u8 = "",
|
||||||
|
|
||||||
|
@ -128,6 +128,8 @@ pub const Response = struct {
|
||||||
pub fn forbidden(s: []u8) Response {
|
pub fn forbidden(s: []u8) Response {
|
||||||
return Response{ .status = stat.Status.FORBIDDEN, .body = s };
|
return Response{ .status = stat.Status.FORBIDDEN, .body = s };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const Cookie = rescookie.Cookie;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run all tests, even the nested ones
|
// Run all tests, even the nested ones
|
||||||
|
|
Loading…
Add table
Reference in a new issue