mirror of
https://github.com/remnawave/migrate.git
synced 2026-05-13 12:16:40 +00:00
- Move header parsing to dedicated util/http_utils.go file - Fix indentation issues in marzneshin.go - Remove unused getEnvOrArg function - Make HTTP header handling consistent across all API clients - Standardize README formatting with consistent bullet points - Improve documentation for custom headers feature - Fix table formatting in documentation These changes maintain all functionality while improving code organization, readability, and consistency throughout the codebase.
21 lines
357 B
Go
21 lines
357 B
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func ParseHeaderMap(raw string) map[string]string {
|
|
headers := make(map[string]string)
|
|
if raw == "" {
|
|
return headers
|
|
}
|
|
|
|
for _, pair := range strings.Split(raw, ",") {
|
|
kv := strings.SplitN(pair, ":", 2)
|
|
if len(kv) == 2 {
|
|
headers[strings.TrimSpace(kv[0])] = strings.TrimSpace(kv[1])
|
|
}
|
|
}
|
|
|
|
return headers
|
|
}
|