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

Function assertBareItem

bareitem.go:29–53  ·  view source on GitHub ↗

assertBareItem asserts that v is a valid bare item according to https://httpwg.org/specs/rfc9651.html#item. v can be either: * an integer (Section 3.3.1.) * a decimal (Section 3.3.2.) * a string (Section 3.3.3.) * a token (Section 3.3.4.) * a byte sequence (Section 3.3.5.) * a boolean (Section 3.3

(v interface{})

Source from the content-addressed store, hash-verified

27// * a date (Section 3.3.7.)
28// * a display string (Section 3.3.8.)
29func assertBareItem(v interface{}) {
30 switch v.(type) {
31 case bool,
32 string,
33 int,
34 int8,
35 int16,
36 int32,
37 int64,
38 uint,
39 uint8,
40 uint16,
41 uint32,
42 uint64,
43 float32,
44 float64,
45 []byte,
46 time.Time,
47 Token,
48 DisplayString:
49 return
50 default:
51 panic(fmt.Errorf("%w: got %s", ErrInvalidBareItem, reflect.TypeOf(v)))
52 }
53}
54
55// marshalBareItem serializes as defined in
56// https://httpwg.org/specs/rfc9651.html#ser-bare-item.

Callers 3

AddMethod · 0.85
NewItemFunction · 0.85
TestAssertBareItemFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestAssertBareItemFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…