mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
migrate remaining code to the new maps
This commit is contained in:
parent
f7dbbf5810
commit
3b1964e9df
@ -26,10 +26,7 @@ fn main() {
|
|||||||
m[key] = m[key] + 1// TODO m[key]++
|
m[key] = m[key] + 1// TODO m[key]++
|
||||||
}
|
}
|
||||||
// Sort the keys
|
// Sort the keys
|
||||||
mut keys := []string
|
mut keys := m.keys()
|
||||||
for e in m.entries {
|
|
||||||
keys << e.key
|
|
||||||
}
|
|
||||||
keys.sort()
|
keys.sort()
|
||||||
// Print the map
|
// Print the map
|
||||||
for key in keys {
|
for key in keys {
|
||||||
|
@ -202,7 +202,7 @@ pub fn (m map_string) str() string {
|
|||||||
}
|
}
|
||||||
// TODO use bytes buffer
|
// TODO use bytes buffer
|
||||||
mut s := '{\n'
|
mut s := '{\n'
|
||||||
//for entry in m.entries {
|
//for key, val in m {
|
||||||
//val := m[entry.key]
|
//val := m[entry.key]
|
||||||
//s += ' "$entry.key" => "$val"\n'
|
//s += ' "$entry.key" => "$val"\n'
|
||||||
//}
|
//}
|
||||||
|
@ -124,9 +124,7 @@ fn (req &Request) do() Response {
|
|||||||
// Add request headers
|
// Add request headers
|
||||||
mut hlist := &C.curl_slist{!}
|
mut hlist := &C.curl_slist{!}
|
||||||
// for i, h := range req.headers {
|
// for i, h := range req.headers {
|
||||||
for entry in req.headers.entries {
|
for key, val in req.headers {
|
||||||
key := entry.key
|
|
||||||
val := req.headers[key]
|
|
||||||
h := '$key: $val'
|
h := '$key: $val'
|
||||||
hlist = C.curl_slist_append(hlist, h.cstr())
|
hlist = C.curl_slist_append(hlist, h.cstr())
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,7 @@ fn (req &Request) do() Response {
|
|||||||
mut headers := ''
|
mut headers := ''
|
||||||
mut resp_headers := ''
|
mut resp_headers := ''
|
||||||
// for header in req.headers {
|
// for header in req.headers {
|
||||||
for entry in req.headers.entries {
|
for key, val in req.headers {
|
||||||
// headers += '$header\r\n'
|
|
||||||
key := entry.key
|
|
||||||
val := req.headers[key]
|
|
||||||
headers += '$key: $val\r\n'
|
headers += '$key: $val\r\n'
|
||||||
}
|
}
|
||||||
if req.typ == 'POST' {
|
if req.typ == 'POST' {
|
||||||
|
Loading…
Reference in New Issue
Block a user