(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func 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 | |
| 44 | func TestAcceptToRedirectOrJSON(t *testing.T) { |
| 45 | wr := herodot.NewJSONWriter(logrusx.New("", "")) |
nothing calls this directly
no test coverage detected