EncodeTestVersion converts a simplified string version of the form 1@abc to a hex-encoded version and base64 encoded source, like 169a05acd705ffc0@YWJj. Allows use of simplified versions in tests for readability, ease of use.
(versionString string)
| 269 | // EncodeTestVersion converts a simplified string version of the form 1@abc to a hex-encoded version and base64 encoded |
| 270 | // source, like 169a05acd705ffc0@YWJj. Allows use of simplified versions in tests for readability, ease of use. |
| 271 | func EncodeTestVersion(versionString string) (encodedString string) { |
| 272 | timestampString, source, found := strings.Cut(versionString, "@") |
| 273 | if !found { |
| 274 | return versionString |
| 275 | } |
| 276 | if len(timestampString) > 0 && timestampString[0] == ' ' { |
| 277 | timestampString = timestampString[1:] |
| 278 | } |
| 279 | timestampUint, err := strconv.ParseUint(timestampString, 10, 64) |
| 280 | if err != nil { |
| 281 | return "" |
| 282 | } |
| 283 | hexTimestamp := strconv.FormatUint(timestampUint, 16) |
| 284 | base64Source := EncodeSource(source) |
| 285 | return hexTimestamp + "@" + base64Source |
| 286 | } |
| 287 | |
| 288 | // GetHelperBody returns the body contents of a document written by HLVAgent. |
| 289 | func (h *HLVAgent) GetHelperBody() string { |