mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 13:32:07 -07:00
new: implemented request.Header and response.Header methods for HTTP proxy modules (closes #174)
This commit is contained in:
parent
9ffef99811
commit
9d0c7bc405
2 changed files with 21 additions and 0 deletions
|
@ -88,6 +88,16 @@ func (j *JSRequest) WasModified() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (j *JSRequest) Header(name, deflt string) string {
|
||||
name = strings.ToLower(name)
|
||||
for _, h := range j.Headers {
|
||||
if name == strings.ToLower(h.Name) {
|
||||
return h.Value
|
||||
}
|
||||
}
|
||||
return deflt
|
||||
}
|
||||
|
||||
func (j *JSRequest) ReadBody() string {
|
||||
raw, err := ioutil.ReadAll(j.req.Body)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue