mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 19:55:26 +00:00
* Add headersPartType for fuzzing * fix nil pointer dereference for headless mode * minor changes+ add integration test * update template in fuzz-header-multiple --------- Co-authored-by: 0x123456789 <0x123456789> Co-authored-by: Tarun Koyalwar <tarun@projectdiscovery.io>
27 lines
732 B
Go
27 lines
732 B
Go
package fuzz
|
|
|
|
import (
|
|
"github.com/projectdiscovery/retryablehttp-go"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRuleIsExecutable(t *testing.T) {
|
|
rule := &Rule{Part: "query"}
|
|
err := rule.Compile(nil, nil)
|
|
require.NoError(t, err, "could not compile rule")
|
|
|
|
req, err := retryablehttp.NewRequest("GET", "https://example.com/?url=localhost", nil)
|
|
require.NoError(t, err, "could not build request")
|
|
|
|
result := rule.isExecutable(req)
|
|
require.True(t, result, "could not get correct result")
|
|
|
|
req, err = retryablehttp.NewRequest("GET", "https://example.com/", nil)
|
|
require.NoError(t, err, "could not build request")
|
|
|
|
result = rule.isExecutable(req)
|
|
require.False(t, result, "could not get correct result")
|
|
}
|