From b1013697d1af4a49cc0a01ac231bf6aff01b2c00 Mon Sep 17 00:00:00 2001 From: Charles WANG Date: Mon, 23 Dec 2019 18:24:53 +0800 Subject: [PATCH] vlib/vweb.v: add public const and functions --- vlib/vweb/vweb.v | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index b180cce6f1..667ce00dbe 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -12,8 +12,9 @@ import ( strings ) -const ( +pub const ( methods_with_form = ['POST', 'PUT', 'PATCH'] + method_all = ['GET','POST','PUT','PATCH','DELETE'] HEADER_SERVER = 'Server: VWeb\r\n' HEADER_CONNECTION_CLOSE = 'Connection: close\r\n' HEADERS_CLOSE = '${HEADER_SERVER}${HEADER_CONNECTION_CLOSE}\r\n' @@ -33,6 +34,7 @@ const ( '.xml': 'text/xml; charset=utf-8' } MAX_HTTP_POST_SIZE = 1024 * 1024 + Default_Port = 8080 ) pub struct Context { @@ -112,13 +114,13 @@ pub fn (ctx &Context) get_cookie(key string) ?string { // TODO refactor return error('Cookie not found') } -fn (ctx mut Context) add_header(key, val string) { +pub fn (ctx mut Context) add_header(key, val string) { //println('add_header($key, $val)') ctx.headers = ctx.headers + '\r\n$key: $val' //println(ctx.headers) } -fn (ctx &Context) get_header(key string) string { +pub fn (ctx &Context) get_header(key string) string { return ctx.req.headers[key] }