ensures internal keyword has priority over response headers in internal map - fixes #667

dev
mzack 2021-10-15 18:45:40 +02:00
parent 0e3c656103
commit dcc5a2840b
1 changed files with 7 additions and 7 deletions

View File

@ -98,6 +98,13 @@ func (request *Request) responseToDSLMap(resp *http.Response, host, matched, raw
for k, v := range extra { for k, v := range extra {
data[k] = v data[k] = v
} }
for _, cookie := range resp.Cookies() {
data[strings.ToLower(cookie.Name)] = cookie.Value
}
for k, v := range resp.Header {
k = strings.ToLower(strings.TrimSpace(k))
data[k] = strings.Join(v, " ")
}
data["path"] = host data["path"] = host
data["matched"] = matched data["matched"] = matched
@ -106,13 +113,6 @@ func (request *Request) responseToDSLMap(resp *http.Response, host, matched, raw
data["content_length"] = resp.ContentLength data["content_length"] = resp.ContentLength
data["status_code"] = resp.StatusCode data["status_code"] = resp.StatusCode
data["body"] = body data["body"] = body
for _, cookie := range resp.Cookies() {
data[strings.ToLower(cookie.Name)] = cookie.Value
}
for k, v := range resp.Header {
k = strings.ToLower(strings.TrimSpace(k))
data[k] = strings.Join(v, " ")
}
data["all_headers"] = headers data["all_headers"] = headers
data["duration"] = duration.Seconds() data["duration"] = duration.Seconds()
data["template-id"] = request.options.TemplateID data["template-id"] = request.options.TemplateID