github.com/cobalt77/jfrog-client-go@v0.14.5/artifactory/services/go/goutils.go (about) 1 package _go 2 3 import ( 4 "encoding/base64" 5 "strings" 6 7 "github.com/cobalt77/jfrog-client-go/artifactory/services/utils" 8 "github.com/cobalt77/jfrog-client-go/utils/io/httputils" 9 ) 10 11 const GoUploadRetries = 3 12 13 func addHeaders(params GoParams, clientDetails *httputils.HttpClientDetails) { 14 utils.AddHeader("X-GO-MODULE-VERSION", params.GetVersion(), &clientDetails.Headers) 15 utils.AddHeader("X-GO-MODULE-CONTENT", base64.StdEncoding.EncodeToString(params.GetModContent()), &clientDetails.Headers) 16 } 17 18 func CreateUrlPath(moduleId, version, props, extension string, url *string) error { 19 *url = strings.Join([]string{*url, moduleId, "@v", version + extension}, "/") 20 properties, err := utils.ParseProperties(props, utils.JoinCommas) 21 if err != nil { 22 return err 23 } 24 25 *url = strings.Join([]string{*url, properties.ToEncodedString()}, ";") 26 if strings.HasSuffix(*url, ";") { 27 tempUrl := *url 28 tempUrl = tempUrl[:len(tempUrl)-1] 29 *url = tempUrl 30 } 31 return nil 32 }