From 668f30856584bc0fa34eac3522810987b31a8233 Mon Sep 17 00:00:00 2001 From: Tim Waldmann Date: Tue, 9 Jan 2024 18:17:55 +0100 Subject: [PATCH] v0.0.364 add ServerHTTP() to GinWrapper for integration testing --- ginext/engine.go | 8 ++++++++ go.sum | 1 + goextVersion.go | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ginext/engine.go b/ginext/engine.go index 5b982bd..cd32131 100644 --- a/ginext/engine.go +++ b/ginext/engine.go @@ -9,6 +9,7 @@ import ( "gogs.mikescher.com/BlackForestBytes/goext/rext" "net" "net/http" + "net/http/httptest" "regexp" "strings" "time" @@ -185,3 +186,10 @@ func (w *GinWrapper) cleanMiddlewareName(fname string) string { return fname } + +// ServeHTTP only used for unit tests +func (w *GinWrapper) ServeHTTP(req *http.Request) *httptest.ResponseRecorder { + respRec := httptest.NewRecorder() + w.engine.ServeHTTP(respRec, req) + return respRec +} diff --git a/go.sum b/go.sum index 6017011..1b208d1 100644 --- a/go.sum +++ b/go.sum @@ -36,6 +36,7 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= diff --git a/goextVersion.go b/goextVersion.go index d0a5304..2db835b 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.363" +const GoextVersion = "0.0.364" -const GoextVersionTimestamp = "2024-01-09T08:51:46+0100" +const GoextVersionTimestamp = "2024-01-09T18:17:55+0100"