(t testing.TB)
| 427 | } |
| 428 | |
| 429 | func testDiscriminatorHTTPHeader(t testing.TB) { |
| 430 | scenarios := []struct { |
| 431 | input map[string]string |
| 432 | output Format |
| 433 | }{ |
| 434 | { |
| 435 | input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="delimited"`}, |
| 436 | output: FmtProtoDelim, |
| 437 | }, |
| 438 | { |
| 439 | input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="illegal"; encoding="delimited"`}, |
| 440 | output: FmtUnknown, |
| 441 | }, |
| 442 | { |
| 443 | input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="illegal"`}, |
| 444 | output: FmtUnknown, |
| 445 | }, |
| 446 | { |
| 447 | input: map[string]string{"Content-Type": `text/plain; version=0.0.4`}, |
| 448 | output: FmtText, |
| 449 | }, |
| 450 | { |
| 451 | input: map[string]string{"Content-Type": `text/plain; version=1.0.0`}, |
| 452 | output: FmtText_1_0_0, |
| 453 | }, |
| 454 | { |
| 455 | input: map[string]string{"Content-Type": `text/plain; version=1.0.0; escaping=allow-utf-8`}, |
| 456 | output: FmtText_1_0_0.WithEscapingScheme(model.NoEscaping), |
| 457 | }, |
| 458 | { |
| 459 | input: map[string]string{"Content-Type": `text/plain; version=1.0.0; escaping=underscores`}, |
| 460 | output: FmtText_1_0_0.WithEscapingScheme(model.UnderscoreEscaping), |
| 461 | }, |
| 462 | { |
| 463 | input: map[string]string{"Content-Type": `text/plain; version=1.0.0; escaping=dots`}, |
| 464 | output: FmtText_1_0_0.WithEscapingScheme(model.DotsEscaping), |
| 465 | }, |
| 466 | { |
| 467 | input: map[string]string{"Content-Type": `text/plain; version=1.0.0; escaping=values`}, |
| 468 | output: FmtText_1_0_0.WithEscapingScheme(model.ValueEncodingEscaping), |
| 469 | }, |
| 470 | { |
| 471 | input: map[string]string{"Content-Type": `text/plain`}, |
| 472 | output: FmtText, |
| 473 | }, |
| 474 | { |
| 475 | input: map[string]string{"Content-Type": `text/plain; version=0.0.3`}, |
| 476 | output: FmtUnknown, |
| 477 | }, |
| 478 | { |
| 479 | input: map[string]string{"Content-Type": `application/openmetrics-text`}, |
| 480 | output: FmtOpenMetrics_0_0_1, |
| 481 | }, |
| 482 | { |
| 483 | input: map[string]string{"Content-Type": `application/openmetrics-text; version=0.0.1`}, |
| 484 | output: FmtOpenMetrics_0_0_1, |
| 485 | }, |
| 486 | { |
no test coverage detected