mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
http: mutable request fields
This commit is contained in:
parent
1e4e882bc2
commit
210b6e36b6
13
examples/fetch.v
Normal file
13
examples/fetch.v
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import time
|
||||||
|
import net.http
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
resp := http.get('https://vlang.io/utc_now') or {
|
||||||
|
println('failed to fetch data from the server')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t := time.unix(resp.text.int())
|
||||||
|
println(t.format())
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
pub:
|
pub mut:
|
||||||
method string
|
method string
|
||||||
headers map[string]string
|
headers map[string]string
|
||||||
cookies map[string]string
|
cookies map[string]string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user