IMG-51: router -> server ns, handlers ns, added error to handler ret val (#1494)

* Introduced server, handlers, error ret in handlerfn

* Server struct with tests

* replace checkErr with return
This commit is contained in:
Victor Sokolov
2025-08-20 14:31:11 +02:00
committed by GitHub
parent 0ddefe1b85
commit 15bd00b221
29 changed files with 1483 additions and 561 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/imgproxy/imgproxy/v3/imagedata"
"github.com/imgproxy/imgproxy/v3/imagetype"
"github.com/imgproxy/imgproxy/v3/options"
"github.com/imgproxy/imgproxy/v3/router"
"github.com/imgproxy/imgproxy/v3/server"
"github.com/imgproxy/imgproxy/v3/vips"
)
@@ -89,7 +89,7 @@ func (p pipeline) Run(ctx context.Context, img *vips.Image, po *options.Processi
return err
}
if err := router.CheckTimeout(ctx); err != nil {
if err := server.CheckTimeout(ctx); err != nil {
return err
}
}

View File

@@ -12,8 +12,8 @@ import (
"github.com/imgproxy/imgproxy/v3/imagedata"
"github.com/imgproxy/imgproxy/v3/imagetype"
"github.com/imgproxy/imgproxy/v3/options"
"github.com/imgproxy/imgproxy/v3/router"
"github.com/imgproxy/imgproxy/v3/security"
"github.com/imgproxy/imgproxy/v3/server"
"github.com/imgproxy/imgproxy/v3/svg"
"github.com/imgproxy/imgproxy/v3/vips"
)
@@ -173,7 +173,7 @@ func transformAnimated(ctx context.Context, img *vips.Image, po *options.Process
return err
}
if err = router.CheckTimeout(ctx); err != nil {
if err = server.CheckTimeout(ctx); err != nil {
return err
}
}
@@ -240,7 +240,7 @@ func saveImageToFitBytes(ctx context.Context, po *options.ProcessingOptions, img
}
imgdata.Close()
if err := router.CheckTimeout(ctx); err != nil {
if err := server.CheckTimeout(ctx); err != nil {
return nil, err
}