MCPcopy Create free account
hub / github.com/WICG/webpackage / parseToken

Method parseToken

go/signedexchange/structuredheader/parser.go:274–286  ·  view source on GitHub ↗

https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.10

()

Source from the content-addressed store, hash-verified

272
273// https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.10
274func (p *parser) parseToken() (Token, error) {
275 if p.isEmpty() {
276 return "", errors.New("structuredheader: token expected, got EOS")
277 }
278 if !isAlpha(p.input[0]) {
279 return "", fmt.Errorf("structuredheader: token expected, got '%c'", p.input[0])
280 }
281 i := 0
282 for i < len(p.input) && isTokenChar(p.input[i]) {
283 i++
284 }
285 return Token(p.getString(i)), nil
286}
287
288// https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.11
289func (p *parser) parseByteSequence() ([]byte, error) {

Callers 3

TestParseTokenFunction · 0.95
parseItemMethod · 0.95

Calls 5

isEmptyMethod · 0.95
getStringMethod · 0.95
isAlphaFunction · 0.85
isTokenCharFunction · 0.85
TokenTypeAlias · 0.85

Tested by 1

TestParseTokenFunction · 0.76