mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-27 18:57:04 +02:00
fix(test): correct test expectations and logic
Httptest and similar callers often leave Host unset; fall back to URL for scheme, host, port, and addr substitution. jsonstore drops the IsTest load short-circuit and duplicate loadNS map registration; tests isolate storesPath. Skip MaxMind background updates when IsTest. Tests restore APISkipOriginCheck, use app-scoped OIDC state cookies, attach route context in middleware helpers, and use locked buffers for concurrent log capture.
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/yusing/godoxy/internal/common"
|
||||
nettypes "github.com/yusing/godoxy/internal/net/types"
|
||||
"github.com/yusing/godoxy/internal/route/routes"
|
||||
"github.com/yusing/goutils/http/reverseproxy"
|
||||
)
|
||||
|
||||
@@ -161,6 +162,10 @@ func newMiddlewaresTest(middlewares []*Middleware, args *testArgs) (*TestResult,
|
||||
|
||||
req := httptest.NewRequest(args.reqMethod, args.reqURL.String(), args.bodyReader())
|
||||
maps.Copy(req.Header, args.headers)
|
||||
req = routes.WithRouteContext(req, fakeMiddlewareHTTPRoute{
|
||||
name: "test-upstream",
|
||||
targetURL: args.upstreamURL,
|
||||
})
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user