Home / Function/ TestBasicAuthForProxySucceed() — gin Function Reference

TestBasicAuthForProxySucceed() — gin Function Reference

Architecture documentation for the TestBasicAuthForProxySucceed() function in auth_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  74064e02_aec1_0ba4_ed63_41a092c9f811["TestBasicAuthForProxySucceed()"]
  8de69f2f_ba6f_8b4b_b264_a61861b36bb6["auth_test.go"]
  74064e02_aec1_0ba4_ed63_41a092c9f811 -->|defined in| 8de69f2f_ba6f_8b4b_b264_a61861b36bb6
  style 74064e02_aec1_0ba4_ed63_41a092c9f811 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

auth_test.go lines 141–156

func TestBasicAuthForProxySucceed(t *testing.T) {
	accounts := Accounts{"admin": "password"}
	router := New()
	router.Use(BasicAuthForProxy(accounts, ""))
	router.Any("/*proxyPath", func(c *Context) {
		c.String(http.StatusOK, c.MustGet(AuthProxyUserKey).(string))
	})

	w := httptest.NewRecorder()
	req, _ := http.NewRequest(http.MethodGet, "/test", nil)
	req.Header.Set("Proxy-Authorization", authorizationHeader("admin", "password"))
	router.ServeHTTP(w, req)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, "admin", w.Body.String())
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestBasicAuthForProxySucceed() do?
TestBasicAuthForProxySucceed() is a function in the gin codebase, defined in auth_test.go.
Where is TestBasicAuthForProxySucceed() defined?
TestBasicAuthForProxySucceed() is defined in auth_test.go at line 141.

Analyze Your Own Codebase

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

Try Supermodel Free