From 72f52255ffb10fced6bebb3bf9716ace281626d2 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 5 May 2021 14:16:24 -0400 Subject: [PATCH] http: set consistency header properly A recent change in 1.9.x inverted the order of these two lines, which caused the X-Consul-Effective-Consistency header to be missing for the servie health endpoints --- .changelog/10189.txt | 4 ++++ agent/health_endpoint.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changelog/10189.txt diff --git a/.changelog/10189.txt b/.changelog/10189.txt new file mode 100644 index 000000000..7cd8cf570 --- /dev/null +++ b/.changelog/10189.txt @@ -0,0 +1,4 @@ +```release-note:bug +http: fix a bug that caused the `X-Consul-Effective-Consistency` header to be missing on +request for service health +``` diff --git a/agent/health_endpoint.go b/agent/health_endpoint.go index d8d5c65f2..d47252626 100644 --- a/agent/health_endpoint.go +++ b/agent/health_endpoint.go @@ -227,8 +227,8 @@ func (s *HTTPHandlers) healthServiceNodes(resp http.ResponseWriter, req *http.Re if args.QueryOptions.UseCache { setCacheMeta(resp, &md) } + out.QueryMeta.ConsistencyLevel = args.QueryOptions.ConsistencyLevel() setMeta(resp, &out.QueryMeta) - out.ConsistencyLevel = args.QueryOptions.ConsistencyLevel() // FIXME: argument parsing should be done before performing the rpc // Filter to only passing if specified