(t *testing.T)
| 309 | } |
| 310 | |
| 311 | func Test_extractHeader(t *testing.T) { |
| 312 | tests := []struct { |
| 313 | description string |
| 314 | headers []*httpgrpc.Header |
| 315 | expectedOutput string |
| 316 | }{ |
| 317 | { |
| 318 | description: "cortex query proto", |
| 319 | headers: []*httpgrpc.Header{ |
| 320 | { |
| 321 | Key: "Content-Type", |
| 322 | Values: []string{"application/x-cortex-query+proto"}, |
| 323 | }, |
| 324 | }, |
| 325 | expectedOutput: "application/x-cortex-query+proto", |
| 326 | }, |
| 327 | { |
| 328 | description: "json", |
| 329 | headers: []*httpgrpc.Header{ |
| 330 | { |
| 331 | Key: "Content-Type", |
| 332 | Values: []string{"application/json"}, |
| 333 | }, |
| 334 | }, |
| 335 | expectedOutput: "application/json", |
| 336 | }, |
| 337 | } |
| 338 | |
| 339 | target := "Content-Type" |
| 340 | for _, test := range tests { |
| 341 | t.Run(test.description, func(t *testing.T) { |
| 342 | require.Equal(t, test.expectedOutput, extractHeader(test.headers, target)) |
| 343 | }) |
| 344 | } |
| 345 | } |
nothing calls this directly
no test coverage detected