withNonJSONPrefix returns a new byte slice prefixed with a non-JSON byte. The input slice is not modified.
(kind nonJSONPrefix, body []byte)
| 30 | |
| 31 | // withNonJSONPrefix returns a new byte slice prefixed with a non-JSON byte. The input slice is not modified. |
| 32 | func withNonJSONPrefix(kind nonJSONPrefix, body []byte) []byte { |
| 33 | buf := make([]byte, 1, len(body)+1) |
| 34 | buf[0] = byte(kind) |
| 35 | buf = append(buf, body...) |
| 36 | return buf |
| 37 | } |
| 38 | |
| 39 | // stripNonJSONPrefix removes the non-JSON prefix byte and returns the kind and the remainder of the byte slice. |
| 40 | func stripNonJSONPrefix(data []byte) (kind nonJSONPrefix, body []byte) { |
no outgoing calls
no test coverage detected