We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f78b99 commit 67c3e5fCopy full SHA for 67c3e5f
PR_Comments/Comment36477.md
@@ -0,0 +1,17 @@
1
+To include the CSRF token in the added test, consider modifying the test code as follows:
2
+
3
+```go
4
+// Retrieve the CSRF token for the endpoint you're testing
5
+csrf := GetCSRF(t, session, "/your/endpoint")
6
7
+// Add the CSRF token to your POST request form data
8
+req := NewRequestWithValues(t, "POST", "/your/endpoint", map[string]string{
9
+ "_csrf": csrf,
10
+ // ...other form fields...
11
+})
12
13
+// Make the request and validate the response
14
+resp := session.MakeRequest(t, req, http.StatusSeeOther)
15
+```
16
17
+This modification ensures that the test aligns with Gitea’s CSRF protection mechanism for form submissions.
0 commit comments