hashicorp / hashicorp/consul

/v1/catalog/services does not error out when specifying a namespace

Open
#7,305 3 comments 0 reactions 0 assignees View on GitHub
theme/api type/docs
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

The `/v1/catalog/services` does not return an error when specifying a namespace in the Community Edition, I think it's the only endpoint that does that:

```sh
$ curl 'http://localhost:8500/v1/catalog/services?ns=test'
Bad request: Invalid query parameter: "ns" - Namespaces is a Consul Enterprise feature
$ curl 'http://localhost:8500/v1/catalog/nodes?ns=test'
[
{
"ID": "e420d3e6-269d-d90d-9858-0837bdb98ba4",
"Node": "MBP-de-Remi",
"Address": "127.0.0.1",
"Datacenter": "dc1",
"TaggedAddresses": {
"lan": "127.0.0.1",
"lan_ipv4": "127.0.0.1",
"wan": "127.0.0.1",
"wan_ipv4": "127.0.0.1"
},
"Meta": {
"consul-network-segment": ""
},
"CreateIndex": 13,
"ModifyIndex": 14
}
]
```

Is the call to `parseEntMetaNoWildcard()` just missing?

Contributor guide

Open the contributing guide

Research direction

Locate the Go handler for /v1/catalog/services and compare its query-parameter handling with /v1/catalog/nodes, focusing on the mentioned parseEntMetaNoWildcard() call. Run the relevant catalog API tests first; done means the Community Edition rejects ns consistently and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.