Skip to content

Commit

Permalink
fix(cookie): improve security and testing configurations
Browse files Browse the repository at this point in the history
- Set cookies to be HttpOnly in the `initTest` function

Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Dec 1, 2024
1 parent 8120a9f commit 9066470
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gofight.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ func (rc *RequestConfig) initTest() (*http.Request, *httptest.ResponseRecorder)

if len(rc.Cookies) > 0 {
for k, v := range rc.Cookies {
req.AddCookie(&http.Cookie{Name: k, Value: v})
req.AddCookie(&http.Cookie{
Name: k,
Value: v,
HttpOnly: true,
})
}
}

Expand Down

0 comments on commit 9066470

Please sign in to comment.