2026-04-23 18:13:14: merge [main:68f79a6bfeb51395820e04cbe827b53c156c0c31];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
This commit is contained in:
1 parent
d4091f8805
commit
a42aeacad0
10 files changed
+145
-138
No files matched your search
+5
-10
@@ -11,7 +11,6 @@ import (
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
http2 "github.com/txix-open/isp-kit/http"
|
||||
@@ -27,7 +26,6 @@ import (
|
||||
|
||||
const (
|
||||
maxMessageSize = 64 * 1024 * 1024
|
||||
proxyTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
type Proxy interface {
|
||||
@@ -191,10 +189,10 @@ func (l Locator) registerEndpoint(
|
||||
}
|
||||
|
||||
paths := []string{
|
||||
domain.ApiPrefix + routeKey.CleanPath, // стандартный маршрут c /api
|
||||
routeKey.CleanPath, // стандартный маршрут
|
||||
}
|
||||
if !routeKey.WithApiPrefix {
|
||||
paths = append(paths, routeKey.CleanPath) // для межмодульного взаимодействия
|
||||
if routeKey.WithApiPrefix {
|
||||
paths = append(paths, domain.ApiPrefix+routeKey.CleanPath) // для endpoint'ов с /api
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
@@ -205,12 +203,9 @@ func (l Locator) registerEndpoint(
|
||||
|
||||
mux.Handler(routeKey.Method, path,
|
||||
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, cancel := context.WithTimeout(r.Context(), proxyTimeout)
|
||||
defer cancel()
|
||||
|
||||
err := handler(ctx, w, r)
|
||||
err := handler(r.Context(), w, r)
|
||||
if err != nil {
|
||||
l.logger.Error(ctx, err)
|
||||
l.logger.Error(r.Context(), err)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user