Fix Tests

This commit is contained in:
Ben Toogood 2020-04-07 11:37:04 +01:00
parent 05ac3ff274
commit 9d598836c3

View File

@ -2,6 +2,7 @@ package auth
import ( import (
"net/http" "net/http"
"net/url"
"testing" "testing"
"github.com/micro/go-micro/v2/auth" "github.com/micro/go-micro/v2/auth"
@ -28,7 +29,7 @@ func TestNamespaceFromRequest(t *testing.T) {
for _, tc := range tt { for _, tc := range tt {
t.Run(tc.Host, func(t *testing.T) { t.Run(tc.Host, func(t *testing.T) {
ns := h.NamespaceFromRequest(&http.Request{Host: tc.Host}) ns := h.NamespaceFromRequest(&http.Request{Host: tc.Host, URL: &url.URL{Host: tc.Host}})
if ns != tc.Namespace { if ns != tc.Namespace {
t.Errorf("Expected namespace %v for host %v, actually got %v", tc.Namespace, tc.Host, ns) t.Errorf("Expected namespace %v for host %v, actually got %v", tc.Namespace, tc.Host, ns)
} }