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

vweb.json()

This commit is contained in:
Alexander Medvednikov 2019-07-30 05:13:44 +02:00
parent 74b3ef3a3f
commit a6df3e51d2

View File

@ -16,8 +16,14 @@ pub:
headers []string
}
pub fn (ctx Context) write(s string) {
//ctx.conn.write(s)
pub fn (ctx Context) json(s string) {
h := ctx.headers.join('\n')
ctx.conn.write('HTTP/1.1 200 OK
Content-Type: application/json
$h
$s
')
}
pub fn (ctx Context) redirect(url string) {