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:
@ -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()
|
||||
|
Reference in New Issue
Block a user