aboutsummaryrefslogtreecommitdiff
path: root/parsers/parser_utils.go
blob: b68826290bcc7fce5c25649ccc8fe30632a755ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package parsers

import (
	"net/http"
	"strings"
)

func JoinArrayMap(obj map[string][]string) map[string]string {
	headers := make(map[string]string, len(obj))
	for key, value := range obj {
		headers[key] = strings.Join(value, ";")
	}

	return headers
}

func CookiesMap(cookiesArray []*http.Cookie) map[string]string {
	cookies := make(map[string]string, len(cookiesArray))
	for _, cookie := range cookiesArray {
		cookies[cookie.Name] = cookie.Value
	}

	return cookies
}