github.com/xmidt-org/webpa-common@v1.11.9/xhttp/xcontext/setErrorEncoder.go (about) 1 package xcontext 2 3 import ( 4 "context" 5 "net/http" 6 7 gokithttp "github.com/go-kit/kit/transport/http" 8 "github.com/xmidt-org/webpa-common/xhttp" 9 ) 10 11 // SetErrorEncoder is a ContextFunc strategy that injects a go-kit ErrorEncoder into the HTTP request context. 12 func SetErrorEncoder(ee gokithttp.ErrorEncoder) gokithttp.RequestFunc { 13 return func(ctx context.Context, _ *http.Request) context.Context { 14 return xhttp.WithErrorEncoder(ctx, ee) 15 } 16 }