mirror of
https://github.com/bettercap/bettercap
synced 2025-07-14 09:03:39 -07:00
fix: resetting response and request Body to unread state (fixes #65)
This commit is contained in:
parent
2771821169
commit
9ba9cb8c52
2 changed files with 6 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
package modules
|
package modules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -61,6 +62,8 @@ func (j *JSRequest) ReadBody() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
j.Body = string(raw)
|
j.Body = string(raw)
|
||||||
|
// reset the request body to the original unread state
|
||||||
|
j.req.Body = ioutil.NopCloser(bytes.NewBuffer(raw))
|
||||||
|
|
||||||
return j.Body
|
return j.Body
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package modules
|
package modules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -99,6 +100,8 @@ func (j *JSResponse) ReadBody() string {
|
||||||
|
|
||||||
j.Body = string(raw)
|
j.Body = string(raw)
|
||||||
j.bodyRead = true
|
j.bodyRead = true
|
||||||
|
// reset the request body to the original unread state
|
||||||
|
j.resp.Body = ioutil.NopCloser(bytes.NewBuffer(raw))
|
||||||
|
|
||||||
return j.Body
|
return j.Body
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue