You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
531 B
Go
22 lines
531 B
Go
2 years ago
|
package internal
|
||
2 years ago
|
|
||
|
import (
|
||
|
"net/http/httptest"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestBuildHeadersNoValue(t *testing.T) {
|
||
|
req := httptest.NewRequest("GET", "/", nil)
|
||
|
req.Header.Add("a", "b")
|
||
2 years ago
|
assert.Nil(t, ProcessHeaders(req.Header))
|
||
2 years ago
|
}
|
||
|
|
||
|
func TestBuildHeadersWithValues(t *testing.T) {
|
||
|
req := httptest.NewRequest("GET", "/", nil)
|
||
|
req.Header.Add("grpc-metadata-a", "b")
|
||
|
req.Header.Add("grpc-metadata-b", "b")
|
||
2 years ago
|
assert.ElementsMatch(t, []string{"gateway-A:b", "gateway-B:b"}, ProcessHeaders(req.Header))
|
||
2 years ago
|
}
|