MCPcopy Create free account
hub / github.com/devploit/nomore403 / TestVerbTamperingSendsCorrectMethods

Function TestVerbTamperingSendsCorrectMethods

cmd/bypass_test.go:92–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestVerbTamperingSendsCorrectMethods(t *testing.T) {
93 resetTestState()
94
95 ts, getRequests := testServer(t, nil)
96 defer ts.Close()
97
98 payloadsDir := setupPayloadsDir(t)
99
100 opts := RequestOptions{
101 uri: ts.URL + "/admin",
102 headers: []header{{"User-Agent", "test"}},
103 method: "GET",
104 proxy: &url.URL{},
105 folder: payloadsDir,
106 timeout: 5000,
107 rateLimit: false,
108 redirect: false,
109 verbose: true,
110 }
111
112 requestMethods(opts)
113
114 reqs := getRequests()
115 if len(reqs) == 0 {
116 t.Fatal("expected requests to be sent, got 0")
117 }
118
119 methods := make(map[string]bool)
120 for _, r := range reqs {
121 methods[r.Method] = true
122 }
123
124 expectedMethods := []string{"GET", "POST", "PUT", "DELETE"}
125 for _, m := range expectedMethods {
126 if !methods[m] {
127 t.Errorf("expected method %s to be sent, but it wasn't. Got methods: %v", m, methods)
128 }
129 }
130}
131
132func TestHeadersBypassSendsCorrectHeaders(t *testing.T) {
133 resetTestState()

Callers

nothing calls this directly

Calls 4

resetTestStateFunction · 0.85
testServerFunction · 0.85
setupPayloadsDirFunction · 0.85
requestMethodsFunction · 0.85

Tested by

no test coverage detected