1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.http: change header behavior to keep custom header case (#9602)

This commit is contained in:
Miccah
2021-04-07 19:12:46 -05:00
committed by GitHub
parent 790961e73a
commit f809d4052f
4 changed files with 405 additions and 66 deletions

View File

@@ -15,16 +15,17 @@ fn parse_request(mut reader io.BufferedReader) ?http.Request {
line = reader.read_line() ?
for line != '' {
key, value := parse_header(line) ?
h.add_str(key, value) ?
h.add_custom(key, value) ?
line = reader.read_line() ?
}
h.coerce(canonicalize: true)
// create map[string]string from headers
// TODO: replace headers and lheaders with http.Header type
mut headers := map[string]string{}
mut lheaders := map[string]string{}
for key in h.keys() {
values := h.values_str(key).join('; ')
values := h.custom_values(key).join('; ')
headers[key] = values
lheaders[key.to_lower()] = values
}