func makeMetadataHeader(modelMetadata, charmMetadata map[string]string) map[string][]string {
	if len(modelMetadata) == 0 && len(charmMetadata) == 0 {
		return nil
	}

	headers := make([]string, 0, len(modelMetadata)+len(charmMetadata))

	// We expect the deployed architecture for a charm to be singular,
	// but it is possible for deployment across multiple architectures.
	// We need to handle this, which violates the general case following.
	if arch, ok := charmMetadata["arch"]; ok {
		for _, a := range strings.Split(arch, ",") {
			headers = append(headers, fmt.Sprintf("arch=%s", a))
		}
		delete(charmMetadata, "arch")
	}

	addHeaders := func(metadata map[string]string) {
		for k, v := range metadata {
			headers = append(headers, fmt.Sprintf("%s=%s", k, v))
		}
	}
	addHeaders(modelMetadata)
	addHeaders(charmMetadata)
	sort.Strings(headers)
	return map[string][]string{jujuMetadataHTTPHeader: headers}
}
// makeMetadataHeader takes the input model and charm metadata and transforms
// it into a header suitable for supply with a "Latest" request via the client.
makeMetadataHeader takes the input model and charm metadata and transforms
it into a header suitable for supply with a "Latest" request via the client.
// makeMetadataHeader takes the input model and charm metadata and transforms // it into a header suitable for supply with a " Latest " request via the client .
func makeMetadataHeader(modelMetadata, charmMetadata map[string]string) map[string][]string {
	if len(modelMetadata) == 0 && len(charmMetadata) == 0 {
		return nil
	}
	headers := make([]string, 0, len(modelMetadata)+len(charmMetadata))
	if arch, ok := charmMetadata["arch"]; ok {
		for _, a := range strings.Split(arch, ",") {
			headers = append(headers, fmt.Sprintf("arch=%s", a))
		}
		delete(charmMetadata, "arch")
	}
	addHeaders := func(metadata map[string]string) {
		for k, v := range metadata {
			headers = append(headers, fmt.Sprintf("%s=%s", k, v))
		}
	}
	addHeaders(modelMetadata)
	addHeaders(charmMetadata)
	sort.Strings(headers)
	return map[string][]string{jujuMetadataHTTPHeader: headers}
}
func makeMetadataHeader ( modelMetadata , charmMetadata map [ string ] string ) map [ string ] [ ] string { if len ( modelMetadata ) == 0 && len ( charmMetadata ) == 0 { return nil } headers := make ( [ ] string , 0 , len ( modelMetadata ) + len ( charmMetadata ) ) if arch , ok := charmMetadata [ " " ] ; ok { for _ , a := range strings . Split ( arch , " " ) { headers = append ( headers , fmt . Sprintf ( " " , a ) ) } delete ( charmMetadata , " " ) } addHeaders := func ( metadata map [ string ] string ) { for k , v := range metadata { headers = append ( headers , fmt . Sprintf ( " " , k , v ) ) } } addHeaders ( modelMetadata ) addHeaders ( charmMetadata ) sort . Strings ( headers ) return map [ string ] [ ] string { jujuMetadataHTTPHeader : headers } }
makeMetadataHeader takes the input model and charm metadata and transforms
it into a header suitable for supply with a "Latest" request via the client.
makeMetadataHeader takes the input model and charm metadata and transforms it into a header suitable for supply with a " Latest " request via the client .
// We expect the deployed architecture for a charm to be singular, // but it is possible for deployment across multiple architectures. // We need to handle this, which violates the general case following.