(t *testing.T, itemsType string, argument string, headerValue string)
| 495 | } |
| 496 | |
| 497 | func RequestWithHeaderParameterArray(t *testing.T, itemsType string, argument string, headerValue string) { |
| 498 | definition := ` |
| 499 | paths: |
| 500 | /ping: |
| 501 | parameters: |
| 502 | - name: ids |
| 503 | in: header |
| 504 | required: true |
| 505 | description: The ids |
| 506 | schema: |
| 507 | type: array |
| 508 | items: |
| 509 | type: ` + itemsType + ` |
| 510 | get: |
| 511 | operationId: ping |
| 512 | summary: Simple ping |
| 513 | ` |
| 514 | context := NewContextBuilder(). |
| 515 | WithResponse(http.StatusOK, "{}"). |
| 516 | WithDefinition("myservice", definition). |
| 517 | Build() |
| 518 | |
| 519 | result := RunCli([]string{"myservice", "ping", "--ids", argument}, context) |
| 520 | |
| 521 | header := result.RequestHeader["ids"] |
| 522 | if header != headerValue { |
| 523 | t.Errorf("Invalid header value, expected: %v, got: %v", headerValue, header) |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | func TestRequestWithQueryStringParameterArray(t *testing.T) { |
| 528 | t.Run("StringArray", func(t *testing.T) { |
no test coverage detected