mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
26 lines
493 B
Go
26 lines
493 B
Go
package mock
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
|
|
"github.com/nais/wonderwall/pkg/ingress"
|
|
mw "github.com/nais/wonderwall/pkg/middleware"
|
|
)
|
|
|
|
func NewGetRequest(target string, ingresses *ingress.Ingresses) *http.Request {
|
|
req := httptest.NewRequest(http.MethodGet, target, nil)
|
|
|
|
path := ingresses.MatchingPath(req)
|
|
req = mw.RequestWithPath(req, path)
|
|
|
|
ing, ok := ingresses.MatchingIngress(req)
|
|
if ok {
|
|
req = mw.RequestWithIngress(req, ing)
|
|
}
|
|
|
|
mw.Logger("test")
|
|
|
|
return req
|
|
}
|