github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_header_names_test.go (about)

     1  // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package checkpoints_test
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeNode/internal/waf/checkpoints"
     7  	"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
     8  	"net/http"
     9  	"testing"
    10  )
    11  
    12  func TestRequestHeaderNamesCheckpoint_RequestValue(t *testing.T) {
    13  	var checkpoint = &checkpoints.RequestHeaderNamesCheckpoint{}
    14  	rawReq, err := http.NewRequest(http.MethodGet, "https://example.com", nil)
    15  	if err != nil {
    16  		t.Fatal(err)
    17  	}
    18  	rawReq.Header.Set("Accept", "text/html")
    19  	rawReq.Header.Set("User-Agent", "Chrome")
    20  	rawReq.Header.Set("Accept-Encoding", "br, gzip")
    21  	var req = requests.NewTestRequest(rawReq)
    22  	t.Log(checkpoint.RequestValue(req, "", nil, 0))
    23  }