MCPcopy Index your code
hub / github.com/dunglas/httpsfv / parseKey

Function parseKey

key.go:60–81  ·  view source on GitHub ↗

parseKey parses as defined in https://httpwg.org/specs/rfc9651.html#parse-key.

(s *scanner)

Source from the content-addressed store, hash-verified

58// parseKey parses as defined in
59// https://httpwg.org/specs/rfc9651.html#parse-key.
60func parseKey(s *scanner) (string, error) {
61 if s.eof() {
62 return "", &UnmarshalError{s.off, ErrInvalidKeyFormat}
63 }
64
65 c := s.data[s.off]
66 if !isLowerCaseAlpha(c) && c != '*' {
67 return "", &UnmarshalError{s.off, ErrInvalidKeyFormat}
68 }
69
70 start := s.off
71 s.off++
72
73 for !s.eof() {
74 if !isKeyChar(s.data[s.off]) {
75 break
76 }
77 s.off++
78 }
79
80 return s.data[start:s.off], nil
81}

Callers 3

parseDictionaryFunction · 0.85
TestParseKeyFunction · 0.85
parseParamsFunction · 0.85

Calls 3

isLowerCaseAlphaFunction · 0.85
isKeyCharFunction · 0.85
eofMethod · 0.80

Tested by 1

TestParseKeyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…