MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / streamableAccepts

Function streamableAccepts

mcp/streamable.go:548–566  ·  view source on GitHub ↗
(values []string)

Source from the content-addressed store, hash-verified

546}
547
548func 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
568func baseMediaType(value string) string {
569 mediaType, _, err := mime.ParseMediaType(value)

Callers 1

ServeHTTPMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…