earlydata_test.go — fiber Source File
Architecture documentation for earlydata_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 89ff38ec_40bf_204e_af8c_37d168e2a1f9["earlydata_test.go"] fcef1725_af89_d6cd_36cd_b228cdcc5acd["errors"] 89ff38ec_40bf_204e_af8c_37d168e2a1f9 --> fcef1725_af89_d6cd_36cd_b228cdcc5acd style 89ff38ec_40bf_204e_af8c_37d168e2a1f9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package earlydata
import (
"errors"
"fmt"
"net/http"
"net/http/httptest"
"reflect"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
const (
headerName = "Early-Data"
headerValOn = "1"
headerValOff = "0"
)
const (
trustedRemoteAddr = "0.0.0.0:1234"
untrustedRemoteAddr = "203.0.113.1:1234"
)
func appWithConfig(t *testing.T, c *fiber.Config) *fiber.App {
t.Helper()
var app *fiber.App
if c == nil {
app = fiber.New()
} else {
app = fiber.New(*c)
}
app.Use(New())
// Middleware to test IsEarly func
const localsKeyTestValid = "earlydata_testvalid"
app.Use(func(c fiber.Ctx) error {
isEarly := IsEarly(c)
switch h := c.Get(headerName); h {
case "", headerValOff:
if isEarly {
return errors.New("is early-data even though it's not")
}
case headerValOn:
switch {
case fiber.IsMethodSafe(c.Method()):
if !isEarly {
return errors.New("should be early-data on safe HTTP methods")
}
default:
if isEarly {
return errors.New("early-data unsupported on unsafe HTTP methods")
}
}
// ... (172 more lines)
Domain
Subdomains
Functions
Classes
Types
Dependencies
- errors
Source
Frequently Asked Questions
What does earlydata_test.go do?
earlydata_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 earlydata_test.go?
earlydata_test.go defines 6 function(s): Test_EarlyData, Test_EarlyDataNext, Test_configDefault_NoConfig, Test_configDefault_WithConfig, appWithConfig, executeExpectations.
What does earlydata_test.go depend on?
earlydata_test.go imports 1 module(s): errors.
Where is earlydata_test.go in the architecture?
earlydata_test.go is located at middleware/earlydata/earlydata_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/earlydata).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free