Skip to content

Commit

Permalink
feat: Adding cookie and referrer in the dump
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Dec 6, 2021
1 parent e42f4c1 commit 104c7d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/dump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ func dumpRequest(r *http.Request) (string, error) {
parts := map[string]string{
"Headers": getBufferContent(r.Header),
"Params": getBufferContent(r.URL.Query()),
"Referer": r.Referer(),
}

if err := r.ParseForm(); err != nil {
return "", fmt.Errorf("unable to parse form: %s", err)
}

cookies := r.Cookies()
cookiesString := make([]string, len(cookies))
for i, cookie := range cookies {
cookiesString[i] = cookie.String()
}
parts["Cookies"] = strings.Join(cookiesString, ", ")

parts["Form"] = getBufferContent(r.PostForm)

body, err := readContent(r.Body)
Expand Down

0 comments on commit 104c7d9

Please sign in to comment.