From 1198f4ee2f3f216cde7b318505f7ebdfe8d7e338 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 12 Sep 2019 12:00:22 +0200 Subject: Rename confusing domain struct from D to Domain --- internal/request/request.go | 6 +++--- internal/request/request_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'internal/request') diff --git a/internal/request/request.go b/internal/request/request.go index 730eb527..74982f33 100644 --- a/internal/request/request.go +++ b/internal/request/request.go @@ -28,7 +28,7 @@ func IsHTTPS(r *http.Request) bool { } // WithHostAndDomain saves host name and domain in the request's context -func WithHostAndDomain(r *http.Request, host string, domain *domain.D) *http.Request { +func WithHostAndDomain(r *http.Request, host string, domain *domain.Domain) *http.Request { ctx := r.Context() ctx = context.WithValue(ctx, ctxHostKey, host) ctx = context.WithValue(ctx, ctxDomainKey, domain) @@ -42,6 +42,6 @@ func GetHost(r *http.Request) string { } // GetDomain extracts the domain from request's context -func GetDomain(r *http.Request) *domain.D { - return r.Context().Value(ctxDomainKey).(*domain.D) +func GetDomain(r *http.Request) *domain.Domain { + return r.Context().Value(ctxDomainKey).(*domain.Domain) } diff --git a/internal/request/request_test.go b/internal/request/request_test.go index 97e40ee4..4bb3c0be 100644 --- a/internal/request/request_test.go +++ b/internal/request/request_test.go @@ -42,17 +42,17 @@ func TestWithHostAndDomain(t *testing.T) { tests := []struct { name string host string - domain *domain.D + domain *domain.Domain }{ { name: "values", host: "gitlab.com", - domain: &domain.D{}, + domain: &domain.Domain{}, }, { name: "no_host", host: "", - domain: &domain.D{}, + domain: &domain.Domain{}, }, } for _, tt := range tests { -- cgit v1.2.3