vweb.json()

pull/1377/head
Alexander Medvednikov 2019-07-30 05:13:44 +02:00
parent 74b3ef3a3f
commit a6df3e51d2
1 changed files with 8 additions and 2 deletions

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) {