mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
Update http_proxy_js_response.go
This commit is contained in:
parent
8f1bcdfe70
commit
8c3ceedf2e
1 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue