(values []string)
| 546 | } |
| 547 | |
| 548 | func streamableAccepts(values []string) (jsonOK, streamOK bool) { |
| 549 | for _, value := range values { |
| 550 | for _, raw := range strings.Split(value, ",") { |
| 551 | token := strings.TrimSpace(raw) |
| 552 | // Ignore Accept parameters like ";charset=utf-8"; match the base media type. |
| 553 | base, _, _ := strings.Cut(token, ";") |
| 554 | switch strings.ToLower(strings.TrimSpace(base)) { |
| 555 | case "application/json", "application/*": |
| 556 | jsonOK = true |
| 557 | case "text/event-stream", "text/*": |
| 558 | streamOK = true |
| 559 | case "*/*": |
| 560 | jsonOK = true |
| 561 | streamOK = true |
| 562 | } |
| 563 | } |
| 564 | } |
| 565 | return jsonOK, streamOK |
| 566 | } |
| 567 | |
| 568 | func baseMediaType(value string) string { |
| 569 | mediaType, _, err := mime.ParseMediaType(value) |
no outgoing calls
no test coverage detected
searching dependent graphs…