From 44a8a1218c17b46b21adbc6cab151e172e748ca3 Mon Sep 17 00:00:00 2001 From: Torin Sandall Date: Thu, 1 Feb 2018 10:57:42 -0800 Subject: [PATCH] Fix delegator return value for single hijacker Previously, the pickDelegator function was not returning a *hijackerDelegator so the return value did not implement the Hijacker interface. As a result, code that attempts to hijack the connection would fail when using a type assertion. All the other cases returned the hijackerDelegator correctly. --- prometheus/promhttp/delegator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/promhttp/delegator.go b/prometheus/promhttp/delegator.go index 5ee095b..659c717 100644 --- a/prometheus/promhttp/delegator.go +++ b/prometheus/promhttp/delegator.go @@ -115,7 +115,7 @@ func init() { }{d, &flusherDelegator{d}, &closeNotifierDelegator{d}} } pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4 - return hijackerDelegator{d} + return &hijackerDelegator{d} } pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5 return struct {