Merge pull request #1862 from hashicorp/irindos-api-client-path
fix(api): address base paths containing a v1 were being truncated
This commit is contained in:
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -236,7 +236,7 @@ func (c *Config) setAddr(addr string) error {
|
||||
|
||||
// If there is a v1 segment, elide everything after it. Do this only for
|
||||
// the last v1 segment in case it's part of the base path.
|
||||
if lastIndex := strings.LastIndex(u.Path, "v1"); lastIndex != -1 {
|
||||
if lastIndex := strings.LastIndex(u.Path, "v1/"); lastIndex != -1 {
|
||||
u.Path = u.Path[:lastIndex]
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,12 @@ func TestConfigSetAddress(t *testing.T) {
|
||||
"http://127.0.0.1:9200/my-install",
|
||||
"",
|
||||
},
|
||||
{
|
||||
"valid project path containing v1",
|
||||
"http://127.0.0.1:9200/randomPathHasv1InIt",
|
||||
"http://127.0.0.1:9200/randomPathHasv1InIt",
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range tests {
|
||||
|
||||
Reference in new issue
Block a user