Update http_proxy_js_response.go

This commit is contained in:
yungtravla 2018-03-21 20:04:22 +10:00 committed by GitHub
parent 57c1aa5a5e
commit fb787679a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,16 +88,13 @@ func (j *JSResponse) GetHeader(name, deflt string) string {
func (j *JSResponse) SetHeader(name, value string) {
name = strings.ToLower(name)
found := false
for _, h := range j.Headers {
for i, h := range j.Headers {
if name == strings.ToLower(h.Name) {
found = true
h.Value = value
j.Headers[i].Value = value
return
}
}
if found == false {
j.Headers = append(j.Headers, JSHeader{name, value})
}
j.Headers = append(j.Headers, JSHeader{name, value})
}
func (j *JSResponse) ToResponse(req *http.Request) (resp *http.Response) {