MCPcopy
hub / github.com/ory/kratos / TestRequestURL

Function TestRequestURL

x/http_test.go:32–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestRequestURL(t *testing.T) {
33 assert.EqualValues(t, RequestURL(&http.Request{
34 URL: urlx.ParseOrPanic("/foo"), Host: "foobar", TLS: &tls.ConnectionState{},
35 }).String(), "https://foobar/foo")
36 assert.EqualValues(t, RequestURL(&http.Request{
37 URL: urlx.ParseOrPanic("/foo"), Host: "foobar",
38 }).String(), "http://foobar/foo")
39 assert.EqualValues(t, RequestURL(&http.Request{
40 URL: urlx.ParseOrPanic("/foo"), Host: "foobar", Header: http.Header{"X-Forwarded-Host": []string{"notfoobar"}, "X-Forwarded-Proto": {"https"}},
41 }).String(), "https://notfoobar/foo")
42}
43
44func TestAcceptToRedirectOrJSON(t *testing.T) {
45 wr := herodot.NewJSONWriter(logrusx.New("", ""))

Callers

nothing calls this directly

Calls 2

RequestURLFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected