From 0575ca67ca4ac7e3f65e8abe392c99c3d8666e3f 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 0000000000..7cd8cf5706 --- /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 d8d5c65f20..d47252626f 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