middleware_test.go — gin Source File
Architecture documentation for middleware_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6ffd4e0d_9875_7480_fa1d_168c8f7de415["middleware_test.go"] 285f3da5_b453_bac8_eb53_efea9feb6bb9["errors"] 6ffd4e0d_9875_7480_fa1d_168c8f7de415 --> 285f3da5_b453_bac8_eb53_efea9feb6bb9 style 6ffd4e0d_9875_7480_fa1d_168c8f7de415 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
import (
"errors"
"net/http"
"strings"
"testing"
"github.com/gin-contrib/sse"
"github.com/stretchr/testify/assert"
)
func TestMiddlewareGeneralCase(t *testing.T) {
signature := ""
router := New()
router.Use(func(c *Context) {
signature += "A"
c.Next()
signature += "B"
})
router.Use(func(c *Context) {
signature += "C"
})
router.GET("/", func(c *Context) {
signature += "D"
})
router.NoRoute(func(c *Context) {
signature += " X "
})
router.NoMethod(func(c *Context) {
signature += " XX "
})
// RUN
w := PerformRequest(router, http.MethodGet, "/")
// TEST
assert.Equal(t, http.StatusOK, w.Code)
assert.Equal(t, "ACDB", signature)
}
func TestMiddlewareNoRoute(t *testing.T) {
signature := ""
router := New()
router.Use(func(c *Context) {
signature += "A"
c.Next()
signature += "B"
})
router.Use(func(c *Context) {
signature += "C"
c.Next()
c.Next()
c.Next()
c.Next()
signature += "D"
})
// ... (194 more lines)
Domain
Subdomains
Functions
Dependencies
- errors
Source
Frequently Asked Questions
What does middleware_test.go do?
middleware_test.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Middleware subdomain.
What functions are defined in middleware_test.go?
middleware_test.go defines 8 function(s): TestMiddlewareAbort, TestMiddlewareAbortHandlersChainAndNext, TestMiddlewareFailHandlersChain, TestMiddlewareGeneralCase, TestMiddlewareNoMethodDisabled, TestMiddlewareNoMethodEnabled, TestMiddlewareNoRoute, TestMiddlewareWrite.
What does middleware_test.go depend on?
middleware_test.go imports 1 module(s): errors.
Where is middleware_test.go in the architecture?
middleware_test.go is located at middleware_test.go (domain: GinCore, subdomain: Middleware).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free