mirror of
				https://github.com/go-kratos/kratos.git
				synced 2025-10-30 23:47:59 +02:00 
			
		
		
		
	perf(metadata): simplify Metadata.Add by avoiding redundant strings.ToLower call (#3671)
This commit is contained in:
		| @@ -26,11 +26,12 @@ func New(mds ...map[string][]string) Metadata { | ||||
|  | ||||
| // Add adds the key, value pair to the header. | ||||
| func (m Metadata) Add(key, value string) { | ||||
| 	if len(key) == 0 { | ||||
| 	if key == "" { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	m[strings.ToLower(key)] = append(m[strings.ToLower(key)], value) | ||||
| 	lowerKey := strings.ToLower(key) | ||||
| 	m[lowerKey] = append(m[lowerKey], value) | ||||
| } | ||||
|  | ||||
| // Get returns the value associated with the passed key. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user