Update http_proxy_js_response.go

This commit is contained in:
yungtravla 2018-03-21 23:52:47 +10:00 committed by GitHub
commit 8c3ceedf2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,6 +97,15 @@ func (j *JSResponse) SetHeader(name, value string) {
j.Headers = append(j.Headers, JSHeader{name, value})
}
func (j *JSResponse) RemoveHeader(name string) {
name = strings.ToLower(name)
for i, h := range j.Headers {
if name == strings.ToLower(h.Name) {
j.Headers = append(j.Headers[:i], j.Headers[i+1:]...)
}
}
}
func (j *JSResponse) ToResponse(req *http.Request) (resp *http.Response) {
resp = goproxy.NewResponse(req, j.ContentType, j.Status, j.Body)
if len(j.Headers) > 0 {