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

Function TestContextNegotiationNotSupport

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

Source from the content-addressed store, hash-verified

1721}
1722
1723func TestContextNegotiationNotSupport(t *testing.T) {
1724 w := httptest.NewRecorder()
1725 c, _ := CreateTestContext(w)
1726 c.Request, _ = http.NewRequest(http.MethodPost, "", nil)
1727
1728 c.Negotiate(http.StatusOK, Negotiate{
1729 Offered: []string{MIMEPOSTForm},
1730 })
1731
1732 assert.Equal(t, http.StatusNotAcceptable, w.Code)
1733 assert.Equal(t, abortIndex, c.index)
1734 assert.True(t, c.IsAborted())
1735}
1736
1737func TestContextNegotiationFormat(t *testing.T) {
1738 c, _ := CreateTestContext(httptest.NewRecorder())

Callers

nothing calls this directly

Calls 3

CreateTestContextFunction · 0.85
NegotiateMethod · 0.80
IsAbortedMethod · 0.80

Tested by

no test coverage detected