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{})
| 27 | // * a date (Section 3.3.7.) |
| 28 | // * a display string (Section 3.3.8.) |
| 29 | func 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. |
no outgoing calls
searching dependent graphs…