MCPcopy Create free account
hub / github.com/goadesign/goa / TestUnsupportedDecoder

Function TestUnsupportedDecoder

http/encoding_test.go:116–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestUnsupportedDecoder(t *testing.T) {
117 // Write the response produced when writing the error returned the
118 // unsupported decoder to validate the response status code.
119 w := httptest.NewRecorder()
120 decoder := &unsupportedDecoder{"application/foo"}
121 err := decoder.Decode(nil)
122 require.Error(t, err)
123 encoder := ErrorEncoder(ResponseEncoder, nil)
124
125 err = encoder(context.Background(), w, err)
126
127 require.NoError(t, err)
128 assert.Equal(t, http.StatusUnsupportedMediaType, w.Code)
129}
130
131func TestResponseEncoder(t *testing.T) {
132 cases := []struct {

Callers

nothing calls this directly

Calls 3

DecodeMethod · 0.95
ErrorEncoderFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected