Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package checkpoints
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
"io"
"net/http"
"testing"
)
func TestResponseBodyCheckpoint_ResponseValue(t *testing.T) {
resp := requests.NewResponse(new(http.Response))
resp.StatusCode = 200
resp.Header = http.Header{}
resp.Header.Set("Hello", "World")
resp.Body = io.NopCloser(bytes.NewBuffer([]byte("Hello, World")))
checkpoint := new(ResponseBodyCheckpoint)
t.Log(checkpoint.ResponseValue(nil, resp, "", nil, 1))
t.Log(checkpoint.ResponseValue(nil, resp, "", nil, 1))
t.Log(checkpoint.ResponseValue(nil, resp, "", nil, 1))
t.Log(checkpoint.ResponseValue(nil, resp, "", nil, 1))
data, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
t.Log("after read:", string(data))
}