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

Function TestParsePayloadPositions

cmd/requester_test.go:394–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

392}
393
394func TestParsePayloadPositions(t *testing.T) {
395 positions, template := parsePayloadPositions("http://example.com/§100§/user/§200§", "§")
396 if len(positions) != 2 {
397 t.Fatalf("expected 2 positions, got %d: %v", len(positions), positions)
398 }
399 if positions[0] != "100" || positions[1] != "200" {
400 t.Errorf("unexpected positions: %v", positions)
401 }
402 // Template should contain internal placeholders for both positions
403 if !strings.Contains(template, payloadPlaceholderPrefix) {
404 t.Errorf("template should contain placeholder prefix, got: %q", template)
405 }
406 // Reconstruct original URL from template + positions
407 reconstructed := template
408 for i, val := range positions {
409 reconstructed = strings.Replace(reconstructed, payloadPlaceholder(i), val, 1)
410 }
411 if reconstructed != "http://example.com/100/user/200" {
412 t.Errorf("reconstructed URL mismatch: %q", reconstructed)
413 }
414}
415
416func TestParsePayloadPositions_NoMarkers(t *testing.T) {
417 positions, _ := parsePayloadPositions("http://example.com/admin", "§")

Callers

nothing calls this directly

Calls 2

parsePayloadPositionsFunction · 0.85
payloadPlaceholderFunction · 0.85

Tested by

no test coverage detected