From e4065ed8d3785fcc7096c87972a449771b6e0b7e Mon Sep 17 00:00:00 2001 From: bettafish Date: Tue, 15 Jun 2021 13:53:55 +0200 Subject: [PATCH] vweb: replace ?string with string on Cookie struct --- vlib/vweb/vweb.v | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index b10ad6992a..c4369c5b37 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -90,8 +90,8 @@ pub struct Cookie { name string value string expires time.Time - path ?string - domain ?string + path string + domain string secure bool http_only bool } @@ -218,12 +218,8 @@ pub fn (mut ctx Context) enable_chunked_transfer(max_chunk_len int) { // Sets a cookie pub fn (mut ctx Context) set_cookie(cookie Cookie) { mut cookie_data := []string{} - if path := cookie.path { - cookie_data << 'path=$path;' - } - if domain := cookie.domain { - cookie_data << 'domain=$domain;' - } + cookie_data << 'path=$cookie.path;' + cookie_data << 'domain=$cookie.domain;' mut secure := if cookie.secure { 'Secure;' } else { '' } secure += if cookie.http_only { ' HttpOnly' } else { ' ' } cookie_data << secure