Skip to content

Commit a1d3ca2

Browse files
Warboss-rusilya.bogdanov
andauthored
Extract strict middleware definition into a separate file in runtime package to allow middlewares to be reused (#1021)
Co-authored-by: ilya.bogdanov <ilya.bogdanov@ispring.com>
1 parent dada8da commit a1d3ca2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

strictmiddleware.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package runtime
2+
3+
import (
4+
"context"
5+
"net/http"
6+
7+
"github.com/gin-gonic/gin"
8+
"github.com/labstack/echo/v4"
9+
)
10+
11+
type StrictEchoHandlerFunc func(ctx echo.Context, request interface{}) (response interface{}, err error)
12+
13+
type StrictEchoMiddlewareFunc func(f StrictEchoHandlerFunc, operationID string) StrictEchoHandlerFunc
14+
15+
type StrictHttpHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (response interface{}, err error)
16+
17+
type StrictHttpMiddlewareFunc func(f StrictHttpHandlerFunc, operationID string) StrictHttpHandlerFunc
18+
19+
type StrictGinHandlerFunc func(ctx *gin.Context, request interface{}) (response interface{}, err error)
20+
21+
type StrictGinMiddlewareFunc func(f StrictGinHandlerFunc, operationID string) StrictGinHandlerFunc

0 commit comments

Comments
 (0)