MCPcopy Create free account
hub / github.com/zalando/skipper / TestHostPatchHandler

Function TestHostPatchHandler

net/host_test.go:89–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestHostPatchHandler(t *testing.T) {
90 host := ""
91 rh := HostPatchHandler{
92 HostPatch{
93 RemovePort: true,
94 RemoteTrailingDot: true,
95 },
96 http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) { host = r.Host }),
97 }
98 rh.ServeHTTP(nil, &http.Request{Host: "example.com.:8080"})
99
100 if host != "example.com" {
101 t.Errorf("expected example.com, got: %s", host)
102 }
103}
104
105func BenchmarkHostPatchCommon(b *testing.B) {
106 hp := HostPatch{RemovePort: true, RemoteTrailingDot: true, ToLower: true}

Callers

nothing calls this directly

Calls 2

ServeHTTPMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…