mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb.json()
This commit is contained in:
parent
74b3ef3a3f
commit
a6df3e51d2
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user