mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
feat: Add traffic-editor plugin (#2825)
This commit is contained in:
22
plugins/wasm-go/extensions/traffic-editor/http.go
Normal file
22
plugins/wasm-go/extensions/traffic-editor/http.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
func headerSlice2Map(headerSlice [][2]string) map[string][]string {
|
||||
headerMap := make(map[string][]string)
|
||||
for _, header := range headerSlice {
|
||||
k, v := strings.ToLower(header[0]), header[1]
|
||||
headerMap[k] = append(headerMap[k], v)
|
||||
}
|
||||
return headerMap
|
||||
}
|
||||
|
||||
func headerMap2Slice(headerMap map[string][]string) [][2]string {
|
||||
headerSlice := make([][2]string, 0, len(headerMap))
|
||||
for k, vs := range headerMap {
|
||||
for _, v := range vs {
|
||||
headerSlice = append(headerSlice, [2]string{k, v})
|
||||
}
|
||||
}
|
||||
return headerSlice
|
||||
}
|
||||
Reference in New Issue
Block a user