MCPcopy
hub / github.com/bettercap/bettercap / OnRequest

Method OnRequest

modules/http_proxy/http_proxy_script.go:79–95  ·  view source on GitHub ↗
(original *http.Request)

Source from the content-addressed store, hash-verified

77}
78
79func (s *HttpProxyScript) OnRequest(original *http.Request) (jsreq *JSRequest, jsres *JSResponse) {
80 if s.doOnRequest {
81 jsreq := NewJSRequest(original)
82 jsres := NewJSResponse(nil)
83
84 if _, err := s.Call("onRequest", jsreq, jsres); err != nil {
85 log.Error("%s", err)
86 return nil, nil
87 } else if jsreq.CheckIfModifiedAndUpdateHash() {
88 return jsreq, nil
89 } else if jsres.CheckIfModifiedAndUpdateHash() {
90 return nil, jsres
91 }
92 }
93
94 return nil, nil
95}
96
97func (s *HttpProxyScript) OnResponse(res *http.Response) (jsreq *JSRequest, jsres *JSResponse) {
98 if s.doOnResponse {

Callers 2

NewHTTPProxyFunction · 0.45
onRequestFilterMethod · 0.45

Calls 5

ErrorFunction · 0.92
NewJSRequestFunction · 0.85
NewJSResponseFunction · 0.85

Tested by

no test coverage detected