Home / Function/ TestBindUri() — gin Function Reference

TestBindUri() — gin Function Reference

Architecture documentation for the TestBindUri() function in githubapi_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  d481f77e_8cd4_8033_4129_01f247749eb5["TestBindUri()"]
  0f251ec6_14b4_8106_498e_821d4e2701cd["exampleFromPath()"]
  d481f77e_8cd4_8033_4129_01f247749eb5 -->|calls| 0f251ec6_14b4_8106_498e_821d4e2701cd
  style d481f77e_8cd4_8033_4129_01f247749eb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

githubapi_test.go lines 312–332

func TestBindUri(t *testing.T) {
	DefaultWriter = os.Stdout
	router := New()

	type Person struct {
		Name string `uri:"name" binding:"required"`
		ID   string `uri:"id" binding:"required"`
	}
	router.Handle(http.MethodGet, "/rest/:name/:id", func(c *Context) {
		var person Person
		require.NoError(t, c.BindUri(&person))
		assert.NotEmpty(t, person.Name)
		assert.NotEmpty(t, person.ID)
		c.String(http.StatusOK, "BindUri test OK")
	})

	path, _ := exampleFromPath("/rest/:name/:id")
	w := PerformRequest(router, http.MethodGet, path)
	assert.Equal(t, "BindUri test OK", w.Body.String())
	assert.Equal(t, http.StatusOK, w.Code)
}

Domain

Subdomains

Frequently Asked Questions

What does TestBindUri() do?
TestBindUri() is a function in the gin codebase.
What does TestBindUri() call?
TestBindUri() calls 1 function(s): exampleFromPath.

Analyze Your Own Codebase

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

Try Supermodel Free