TestBasicAuthForProxy407() — gin Function Reference
Architecture documentation for the TestBasicAuthForProxy407() function in auth_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD efb79e23_8192_7d12_a0ab_a8a4ea7b9c04["TestBasicAuthForProxy407()"] 8de69f2f_ba6f_8b4b_b264_a61861b36bb6["auth_test.go"] efb79e23_8192_7d12_a0ab_a8a4ea7b9c04 -->|defined in| 8de69f2f_ba6f_8b4b_b264_a61861b36bb6 style efb79e23_8192_7d12_a0ab_a8a4ea7b9c04 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
auth_test.go lines 158–176
func TestBasicAuthForProxy407(t *testing.T) {
called := false
accounts := Accounts{"foo": "bar"}
router := New()
router.Use(BasicAuthForProxy(accounts, ""))
router.Any("/*proxyPath", func(c *Context) {
called = true
c.String(http.StatusOK, c.MustGet(AuthProxyUserKey).(string))
})
w := httptest.NewRecorder()
req, _ := http.NewRequest(http.MethodGet, "/test", nil)
req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:password")))
router.ServeHTTP(w, req)
assert.False(t, called)
assert.Equal(t, http.StatusProxyAuthRequired, w.Code)
assert.Equal(t, "Basic realm=\"Proxy Authorization Required\"", w.Header().Get("Proxy-Authenticate"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestBasicAuthForProxy407() do?
TestBasicAuthForProxy407() is a function in the gin codebase, defined in auth_test.go.
Where is TestBasicAuthForProxy407() defined?
TestBasicAuthForProxy407() is defined in auth_test.go at line 158.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free