MCPcopy
hub / github.com/gin-gonic/gin / TestContextDefaultQueryOnEmptyRequest

Function TestContextDefaultQueryOnEmptyRequest

context_test.go:803–816  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

801}
802
803func TestContextDefaultQueryOnEmptyRequest(t *testing.T) {
804 c, _ := CreateTestContext(httptest.NewRecorder()) // here c.Request == nil
805 assert.NotPanics(t, func() {
806 value, ok := c.GetQuery("NoKey")
807 assert.False(t, ok)
808 assert.Empty(t, value)
809 })
810 assert.NotPanics(t, func() {
811 assert.Equal(t, "nada", c.DefaultQuery("NoKey", "nada"))
812 })
813 assert.NotPanics(t, func() {
814 assert.Empty(t, c.Query("NoKey"))
815 })
816}
817
818func TestContextQueryAndPostForm(t *testing.T) {
819 c, _ := CreateTestContext(httptest.NewRecorder())

Callers

nothing calls this directly

Calls 4

CreateTestContextFunction · 0.85
GetQueryMethod · 0.80
DefaultQueryMethod · 0.80
QueryMethod · 0.80

Tested by

no test coverage detected