BuildUserAgent creates a User-Agent string in the format: "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_env_value}"
()
| 41 | // BuildUserAgent creates a User-Agent string in the format: |
| 42 | // "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_env_value}" |
| 43 | func BuildUserAgent() string { |
| 44 | osInformation := getOperatingSystemInformation() |
| 45 | goVersion := runtime.Version() |
| 46 | cfCliVersion := GetCfCliVersion() |
| 47 | customValue := getCustomEnvValue() |
| 48 | |
| 49 | userAgent := fmt.Sprintf("Multiapps-CF-plugin/%s (%s) %s (%s)", pluginVersion, osInformation, goVersion, cfCliVersion) |
| 50 | |
| 51 | if customValue != "" { |
| 52 | userAgent = fmt.Sprintf("%s %s", userAgent, customValue) |
| 53 | } |
| 54 | |
| 55 | return userAgent |
| 56 | } |
| 57 | |
| 58 | // getOperatingSystemInformation returns OS name and architecture |
| 59 | func getOperatingSystemInformation() string { |
no test coverage detected