(t *testing.T, b Binding, name, path, badPath, body, badBody string)
| 1341 | } |
| 1342 | |
| 1343 | func testProtoBodyBinding(t *testing.T, b Binding, name, path, badPath, body, badBody string) { |
| 1344 | assert.Equal(t, name, b.Name()) |
| 1345 | |
| 1346 | obj := protoexample.Test{} |
| 1347 | req := requestWithBody(http.MethodPost, path, body) |
| 1348 | req.Header.Add("Content-Type", MIMEPROTOBUF) |
| 1349 | err := b.Bind(req, &obj) |
| 1350 | require.NoError(t, err) |
| 1351 | assert.Equal(t, "yes", *obj.Label) |
| 1352 | |
| 1353 | obj = protoexample.Test{} |
| 1354 | req = requestWithBody(http.MethodPost, badPath, badBody) |
| 1355 | req.Header.Add("Content-Type", MIMEPROTOBUF) |
| 1356 | err = ProtoBuf.Bind(req, &obj) |
| 1357 | require.Error(t, err) |
| 1358 | } |
| 1359 | |
| 1360 | type hook struct{} |
| 1361 |
no test coverage detected