1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: fix a cookie bug

This commit is contained in:
Alexander Medvednikov 2019-12-13 21:11:40 +03:00
parent 83b8d642b4
commit fb3da327d6

View File

@ -94,7 +94,13 @@ pub fn (ctx mut Context) set_cookie(key, val string) {
} }
pub fn (ctx &Context) get_cookie(key string) ?string { // TODO refactor pub fn (ctx &Context) get_cookie(key string) ?string { // TODO refactor
cookie_header := ' ' + ctx.get_header('cookie') mut cookie_header := ctx.get_header('cookie')
if cookie_header == '' {
cookie_header = ctx.get_header('Cookie')
}
cookie_header = ' ' + cookie_header
//println('cookie_header="$cookie_header"')
//println(ctx.req.headers)
cookie := if cookie_header.contains(';') { cookie := if cookie_header.contains(';') {
cookie_header.find_between(' $key=', ';') cookie_header.find_between(' $key=', ';')
} else { } else {