jsonrpc2: fix Content-Length header parsing to be case-insensitive

This commit is contained in:
Nithin P 2026-02-13 22:46:57 +05:30 • committed by Maciej Kisiel
commit 23ab1bfd26

View file

@ -163,8 +163,8 @@ func (r *headerReader) Read(ctx context.Context) (Message, error) {
return nil, fmt.Errorf("invalid header line %q", line)
}
name, value := line[:colon], strings.TrimSpace(line[colon+1:])
switch name {
case "Content-Length":
switch {
case strings.EqualFold(name, "Content-Length"):
if contentLength, err = strconv.ParseInt(value, 10, 32); err != nil {
return nil, fmt.Errorf("failed parsing Content-Length: %v", value)
}