migrate remaining code to the new maps

pull/1143/head
Alexander Medvednikov 2019-07-14 22:26:21 +02:00
parent f7dbbf5810
commit 3b1964e9df
4 changed files with 4 additions and 12 deletions

View File

@ -26,10 +26,7 @@ fn main() {
m[key] = m[key] + 1// TODO m[key]++
}
// Sort the keys
mut keys := []string
for e in m.entries {
keys << e.key
}
mut keys := m.keys()
keys.sort()
// Print the map
for key in keys {

View File

@ -202,7 +202,7 @@ pub fn (m map_string) str() string {
}
// TODO use bytes buffer
mut s := '{\n'
//for entry in m.entries {
//for key, val in m {
//val := m[entry.key]
//s += ' "$entry.key" => "$val"\n'
//}

View File

@ -124,9 +124,7 @@ fn (req &Request) do() Response {
// Add request headers
mut hlist := &C.curl_slist{!}
// for i, h := range req.headers {
for entry in req.headers.entries {
key := entry.key
val := req.headers[key]
for key, val in req.headers {
h := '$key: $val'
hlist = C.curl_slist_append(hlist, h.cstr())
}

View File

@ -42,10 +42,7 @@ fn (req &Request) do() Response {
mut headers := ''
mut resp_headers := ''
// for header in req.headers {
for entry in req.headers.entries {
// headers += '$header\r\n'
key := entry.key
val := req.headers[key]
for key, val in req.headers {
headers += '$key: $val\r\n'
}
if req.typ == 'POST' {