mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: run vfmt over vlib files, so that v doc -m vlib/
can run without warnings
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
module picohttpparser
|
||||
|
||||
pub struct Response {
|
||||
fd int
|
||||
fd int
|
||||
pub:
|
||||
date byteptr
|
||||
date byteptr
|
||||
buf_start byteptr
|
||||
pub mut:
|
||||
buf byteptr
|
||||
buf byteptr
|
||||
}
|
||||
|
||||
[inline]
|
||||
@ -19,68 +19,68 @@ fn (mut r Response) write_str(s string) {
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) http_ok() &Response {
|
||||
r.write_str("HTTP/1.1 200 OK\r\n")
|
||||
r.write_str('HTTP/1.1 200 OK\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) header(k, v string) &Response {
|
||||
pub fn (mut r Response) header(k string, v string) &Response {
|
||||
r.write_str(k)
|
||||
r.write_str(": ")
|
||||
r.write_str(': ')
|
||||
r.write_str(v)
|
||||
r.write_str("\r\n")
|
||||
r.write_str('\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) header_date() &Response {
|
||||
r.write_str("Date: ")
|
||||
r.write_str('Date: ')
|
||||
unsafe {
|
||||
r.buf += cpy(r.buf, r.date, 29)
|
||||
}
|
||||
r.write_str("\r\n")
|
||||
r.write_str('\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) header_server() &Response {
|
||||
r.write_str("Server: V\r\n")
|
||||
r.write_str('Server: V\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) content_type(s string) &Response {
|
||||
r.write_str("Content-Type: ")
|
||||
r.write_str('Content-Type: ')
|
||||
r.write_str(s)
|
||||
r.write_str("\r\n")
|
||||
r.write_str('\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) html() &Response {
|
||||
r.write_str("Content-Type: text/html\r\n")
|
||||
r.write_str('Content-Type: text/html\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) plain() &Response {
|
||||
r.write_str("Content-Type: text/plain\r\n")
|
||||
r.write_str('Content-Type: text/plain\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) json() &Response {
|
||||
r.write_str("Content-Type: application/json\r\n")
|
||||
r.write_str('Content-Type: application/json\r\n')
|
||||
return r
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut r Response) body(body string) {
|
||||
r.write_str("Content-Length: ")
|
||||
r.write_str('Content-Length: ')
|
||||
unsafe {
|
||||
r.buf += C.u64toa(r.buf, body.len)
|
||||
}
|
||||
r.write_str("\r\n\r\n")
|
||||
r.write_str('\r\n\r\n')
|
||||
r.write_str(body)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user