vweb: use http.Cookie
							parent
							
								
									bff84aab59
								
							
						
					
					
						commit
						8bb2ccfdbc
					
				|  | @ -2620,7 +2620,8 @@ pub fn (mut c Checker) ident(mut node ast.Ident) ast.Type { | |||
| 		if !name.contains('.') && node.mod != 'builtin' { | ||||
| 			name = '${node.mod}.$node.name' | ||||
| 		} | ||||
| 		if name == c.const_decl { | ||||
| 		if name == c.const_decl && !c.pref.translated { | ||||
| 			// TODO allow references, do not just check by name
 | ||||
| 			c.error('cycle in constant `$c.const_decl`', node.pos) | ||||
| 			return ast.void_type | ||||
| 		} | ||||
|  |  | |||
|  | @ -193,14 +193,6 @@ pub fn (ctx Context) init_server() { | |||
| // Probably you can use it for check user session cookie or add header.
 | ||||
| pub fn (ctx Context) before_request() {} | ||||
| 
 | ||||
| pub struct Cookie { | ||||
| 	name      string | ||||
| 	value     string | ||||
| 	expires   time.Time | ||||
| 	secure    bool | ||||
| 	http_only bool | ||||
| } | ||||
| 
 | ||||
| // vweb intern function
 | ||||
| [manualfree] | ||||
| pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bool { | ||||
|  | @ -311,7 +303,7 @@ pub fn (mut ctx Context) not_found() Result { | |||
| } | ||||
| 
 | ||||
| // Sets a cookie
 | ||||
| pub fn (mut ctx Context) set_cookie(cookie Cookie) { | ||||
| pub fn (mut ctx Context) set_cookie(cookie http.Cookie) { | ||||
| 	mut cookie_data := []string{} | ||||
| 	mut secure := if cookie.secure { 'Secure;' } else { '' } | ||||
| 	secure += if cookie.http_only { ' HttpOnly' } else { ' ' } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue