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

picoev: make compile, add header parsing

This commit is contained in:
Sumeet Chhetri
2020-06-07 04:53:30 +05:30
committed by GitHub
parent d62d0c40d2
commit 442030a7c8
6 changed files with 41 additions and 17 deletions

View File

@ -23,10 +23,18 @@ fn hello_response() string {
fn callback(req picohttpparser.Request, mut res picohttpparser.Response) {
if picohttpparser.cmpn(req.method, 'GET ', 4) {
if picohttpparser.cmp(req.path, '/t') {
res.http_ok().header_server().header_date().plain().body(hello_response())
res.http_ok()
res.header_server()
res.header_date()
res.plain()
res.body(hello_response())
}
else if picohttpparser.cmp(req.path, '/j') {
res.http_ok().header_server().header_date().json().body(json_response())
res.http_ok()
res.header_server()
res.header_date()
res.json()
res.body(json_response())
}
else {
res.http_404()