Home / File/ rewrite_test.go — fiber Source File

rewrite_test.go — fiber Source File

Architecture documentation for rewrite_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  f5365631_1ba8_5f21_5ff7_68fb70dbba7b["rewrite_test.go"]
  cc7104af_aece_1fe5_3985_791c7f34910c["context"]
  f5365631_1ba8_5f21_5ff7_68fb70dbba7b --> cc7104af_aece_1fe5_3985_791c7f34910c
  style f5365631_1ba8_5f21_5ff7_68fb70dbba7b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package rewrite

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"testing"

	"github.com/gofiber/fiber/v3"
	"github.com/stretchr/testify/require"
	"github.com/valyala/fasthttp"
)

func Test_New(t *testing.T) {
	// Test with no config
	m := New()

	if m == nil {
		t.Error("Expected middleware to be returned, got nil")
	}

	// Test with config
	m = New(Config{
		Rules: map[string]string{
			"/old": "/new",
		},
	})

	if m == nil {
		t.Error("Expected middleware to be returned, got nil")
	}

	// Test with full config
	m = New(Config{
		Next: func(fiber.Ctx) bool {
			return true
		},
		Rules: map[string]string{
			"/old": "/new",
		},
	})

	if m == nil {
		t.Error("Expected middleware to be returned, got nil")
	}
}

func Test_Rewrite(t *testing.T) {
	// Case 1: Next function always returns true
	app := fiber.New()
	app.Use(New(Config{
		Next: func(fiber.Ctx) bool {
			return true
		},
		Rules: map[string]string{
			"/old": "/new",
		},
	}))

// ... (325 more lines)

Domain

Subdomains

Dependencies

  • context

Frequently Asked Questions

What does rewrite_test.go do?
rewrite_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in rewrite_test.go?
rewrite_test.go defines 4 function(s): Benchmark_Rewrite, Benchmark_Rewrite_Parallel, Test_New, Test_Rewrite.
What does rewrite_test.go depend on?
rewrite_test.go imports 1 module(s): context.
Where is rewrite_test.go in the architecture?
rewrite_test.go is located at middleware/rewrite/rewrite_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/rewrite).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free