From db2ed194f7bba9038655d75fdbff908bd60c5336 Mon Sep 17 00:00:00 2001 From: Reindert Vetter Date: Sat, 6 Jun 2020 22:45:40 +0200 Subject: [PATCH] lanvard/lanvard#49 match host in routes --- app/http/kernel.go | 4 ++-- app/http/middleware/validate_post_size.go | 9 ++------- src/adapters/user.go | 1 - test/user_controller_test.go | 4 ++-- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/http/kernel.go b/app/http/kernel.go index 24e5593..aca565f 100755 --- a/app/http/kernel.go +++ b/app/http/kernel.go @@ -13,8 +13,8 @@ func NewKernel(app inter.App) http.Kernel { } } -func pipes() []inter.Pipe { - return []inter.Pipe{ +func pipes() []inter.HttpMiddleware { + return []inter.HttpMiddleware{ // todo remove or use ValidatePostSize middleware.ValidatePostSize{}, } diff --git a/app/http/middleware/validate_post_size.go b/app/http/middleware/validate_post_size.go index 723034e..5d3f5ae 100644 --- a/app/http/middleware/validate_post_size.go +++ b/app/http/middleware/validate_post_size.go @@ -1,13 +1,8 @@ package middleware -import ( - "github.com/lanvard/contract/inter" - "github.com/lanvard/foundation" -) +import "github.com/lanvard/contract/inter" -type ValidatePostSize struct { - App foundation.Application -} +type ValidatePostSize struct{} func (v ValidatePostSize) Handle(request inter.Request, next inter.MiddlewareDestination) inter.Response { // todo validate diff --git a/src/adapters/user.go b/src/adapters/user.go index 2b7c651..42db213 100644 --- a/src/adapters/user.go +++ b/src/adapters/user.go @@ -12,7 +12,6 @@ var User = struct { }{ AllByRequest: func(request inter.Request) ([]contract.User, error) { var err error - var users []contract.User users = append(users, model.NewUser(5435, "test@lanvard.com")) diff --git a/test/user_controller_test.go b/test/user_controller_test.go index 56853f8..73a2746 100755 --- a/test/user_controller_test.go +++ b/test/user_controller_test.go @@ -10,7 +10,7 @@ import ( func Test_get_all_users(t *testing.T) { request := http.NewRequest(http.Options{ Method: method.Get, - Url: "/api/users", + Uri: "/api/users", }) ResponseByRequest(request) @@ -22,7 +22,7 @@ func Test_get_all_users(t *testing.T) { func Test_get_user_by_id(t *testing.T) { request := http.NewRequest(http.Options{ Method: method.Get, - Url: "/api/user/64564", + Uri: "/api/user/64564", }) result := ResponseByRequest(request)