static_test.go — fiber Source File
Architecture documentation for static_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f26a2d79_1e01_f027_82eb_45c4308747e8["static_test.go"] 70376b8a_10aa_027c_6ef9_130fd8be3949["embed"] f26a2d79_1e01_f027_82eb_45c4308747e8 --> 70376b8a_10aa_027c_6ef9_130fd8be3949 style f26a2d79_1e01_f027_82eb_45c4308747e8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package static
import (
"embed"
"io"
"io/fs"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/gofiber/fiber/v3"
)
const (
winOS = "windows"
testCSSDir = "../../.github/testdata/fs/css"
)
var testConfig = fiber.TestConfig{
Timeout: 10 * time.Second,
FailOnTimeout: true,
}
// go test -run Test_Static_Index_Default
func Test_Static_Index_Default(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Get("/prefix", New("../../.github/workflows"))
app.Get("", New("../../.github/"))
app.Get("test", New("", Config{
IndexNames: []string{"index.html"},
}))
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 200, resp.StatusCode, "Status code")
require.NotEmpty(t, resp.Header.Get(fiber.HeaderContentLength))
require.Equal(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Contains(t, string(body), "Hello, World!")
resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/not-found", http.NoBody))
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 404, resp.StatusCode, "Status code")
require.NotEmpty(t, resp.Header.Get(fiber.HeaderContentLength))
require.Equal(t, fiber.MIMETextPlainCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
// ... (1173 more lines)
Domain
Subdomains
Functions
- Benchmark_SanitizePath()
- Test_Route_Static_HasPrefix()
- Test_Route_Static_Root()
- Test_Router_Mount_n_Static()
- Test_SanitizePath()
- Test_SanitizePath_Error()
- Test_Static_Compress()
- Test_Static_Compress_WithFileSuffixes()
- Test_Static_Compress_WithoutEncoding()
- Test_Static_Custom_CacheControl()
- Test_Static_Direct()
- Test_Static_Disable_Cache()
- Test_Static_Download()
- Test_Static_Download_NonASCII()
- Test_Static_FS()
- Test_Static_FS_Browse()
- Test_Static_FS_Prefix_Wildcard()
- Test_Static_Group()
- Test_Static_Index_Default()
- Test_Static_MaxAge()
- Test_Static_Next()
- Test_Static_NotFoundHandler()
- Test_Static_PathTraversal()
- Test_Static_PathTraversal_WindowsOnly()
- Test_Static_Prefix()
- Test_Static_Prefix_Wildcard()
- Test_Static_Trailing_Slash()
- Test_Static_Wildcard()
- Test_isFile()
Classes
Dependencies
- embed
Source
Frequently Asked Questions
What does static_test.go do?
static_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 static_test.go?
static_test.go defines 29 function(s): Benchmark_SanitizePath, Test_Route_Static_HasPrefix, Test_Route_Static_Root, Test_Router_Mount_n_Static, Test_SanitizePath, Test_SanitizePath_Error, Test_Static_Compress, Test_Static_Compress_WithFileSuffixes, Test_Static_Compress_WithoutEncoding, Test_Static_Custom_CacheControl, and 19 more.
What does static_test.go depend on?
static_test.go imports 1 module(s): embed.
Where is static_test.go in the architecture?
static_test.go is located at middleware/static/static_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/static).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free